vue回転react試行


今日reactを勉強しましたが、vue文法に似ているような気がします.そこで、何度も検索してみると、このようなサービスを提供できるツールがあります.
https://tools.w3cub.com/vue-to-react
vueとreactのライフサイクル
created: 'componentWillMount',
mounted: 'componentDidMount',
updated: 'componentDidUpdate',
beforeDestroy: 'componentWillUnmount',
errorCaptured: 'componentDidCatch',
render: 'render'

reactにはcomputedsはありません
reactにはcomputedはありません.手動setStateをサポートする必要があります.
hooks構文
hooksでsetStateのような操作を復元する方法は、次のとおりです.
useReducerを使用できます
const [state, setState] = useReducer(
    (state, action) => {
      return {
        ...state,
        ...action
      };
    },{ name: '   ',category: '    ' })
setState({ name: '  ' })