标签:str lan update ons compute 需要 学习 turn date
今天学习了一下react,感觉跟vue 语法类似。于是举一反三搜索了一下,发现由个工具,可以提供这样子的服务:https://tools.w3cub.com/vue-to-react
created: ‘componentWillMount‘,
mounted: ‘componentDidMount‘,
updated: ‘componentDidUpdate‘,
beforeDestroy: ‘componentWillUnmount‘,
errorCaptured: ‘componentDidCatch‘,
render: ‘render‘
react 没有 computed, 需要支持 手动 setState
hooks 下如何还原 setState 类似的操作:
可以使用 useReducer
const [state, setState] = useReducer(
(state, action) => {
return {
...state,
...action
};
},{ name: ‘小熊猫‘,category: ‘小熊猫科‘ })
setState({ name: ‘金鱼‘ })
标签:str lan update ons compute 需要 学习 turn date
原文地址:https://blog.51cto.com/xp114/2429447