React 16.9
我知道这一点class component state
:
class JustAnotherCounter extends Component {
state = {
count: 0
};
相当于使用Hooks useState
:
function JustAnotherCounter() {
const [count, setCount] = useState(0);
..但是下面使用Hooks的类组件状态的等价物是什么?: useState
class Main extends Component {
state = {
step: 1,
firstName: '',
lastName: '',
jobTitle: '',
jobCompany: '',
jobLocation: '',
}
任何帮助将非常感激。