-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
40 lines (33 loc) · 900 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
const messages = [
"learn",
"appldfsd",
"get rich",
];
const Hello = () => {
const [step, setStep] = useState(1);
const handlernext = () => {
if (step < 3) {
setStep(step + 1);
}
};
const handlerback = () => {
if (step > 1) {
setStep(step - 1);
}
};
return (
<div className='steps'>
<div className='numbers'>
<div className='active'>step {step}</div>
</div>
<p className="message">{messages[step - 1]}</p>
<div className="button">
<button style={{ backgroundColor: "red", color: "green" }} onClick={handlerback}>back</button>
<button style={{ backgroundColor: "red", color: "green" }} onClick={handlernext}>next</button>
</div>
</div>
);
};
ReactDOM.render(<Hello />, document.getElementById('root'));