将React组件转换为Vue组件

将React组件转换为Vue组件

JavaScript Vue.js相关

访问GitHub主页

共54Star

详细介绍

react-to-vue

NPM version NPM downloads CircleCI donate chat

Install

yarn add @egoist/react-to-vue

Usage

import Vue from 'vue'
import React from 'react'
import toVue from '@egoist/react-to-vue'

const ReactComponent = () => {
  const [count, setCount] = React.useState(0)
  return <button onClick={() => setCount(count + 1)}>{count}</button>
}

const VueComponent = toVue(ReactComponent)

new Vue({
  el: '#app',
  render: h => h(VueComponent)
})

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

@egoist/react-to-vue © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).

github.com/egoist · GitHub @EGOIST · Twitter @_egoistlily