vue-to-react
Try to transform Vue component(jsx syntax) to React component.
It is under developing, so it's not stable now. The 1st stable version will come soon and be released v1.0.0.
Install
Prerequisites: Node.js (>=8.0) and NPM (>=5.0)
Usage
Examples:
The above code will transform my/vue/component.js
to ${process.cwd()}/react.js
.
The above code will transform my/vue/component.js
to my/vue/test.js
.
Here is a demo.
Attention
The following list you should be pay attention when you are using vue-to-react to transform a vue component to react component:
- Only supprts jsx syntax of vue component, don't support SFC . See jsx in vue
- Not support
watch
prop of vue component - Not support
components
prop of vue component. See component tip - Only supports partial lift-cycle methods of vue component. Lift-cycle relations mapping as follows:
- Each computed prop should be a function:
- Computed prop of vue component will be put into the render method of react component:
Development
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request