【发布时间】:2020-09-12 16:03:02
【问题描述】:
React 16.9
我知道这个class component state:
class JustAnotherCounter extends Component {
state = {
count: 0
};
相当于使用 Hooks useState:
function JustAnotherCounter() {
const [count, setCount] = useState(0);
..但是下面使用 Hooks useStateuseState 的 类组件状态 的等价物是什么?:
class Main extends Component {
state = {
step: 1,
firstName: '',
lastName: '',
jobTitle: '',
jobCompany: '',
jobLocation: '',
}
任何帮助将不胜感激。
【问题讨论】:
标签: javascript reactjs react-native ecmascript-6