{"id":13701467,"url":"https://github.com/SmallComfort/react-vue","last_synced_at":"2025-05-04T21:31:00.371Z","repository":{"id":51205776,"uuid":"89192021","full_name":"SmallComfort/react-vue","owner":"SmallComfort","description":"Run Vue in React and React Native","archived":false,"fork":true,"pushed_at":"2018-06-24T14:17:49.000Z","size":19498,"stargazers_count":1227,"open_issues_count":2,"forks_count":63,"subscribers_count":43,"default_branch":"dev","last_synced_at":"2025-05-04T13:04:20.940Z","etag":null,"topics":["react","react-native","react-vue","vue"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"vuejs/vue","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SmallComfort.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-24T03:02:34.000Z","updated_at":"2025-04-29T16:33:12.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/SmallComfort/react-vue","commit_stats":null,"previous_names":[],"tags_count":100,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmallComfort%2Freact-vue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmallComfort%2Freact-vue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmallComfort%2Freact-vue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmallComfort%2Freact-vue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmallComfort","download_url":"https://codeload.github.com/SmallComfort/react-vue/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252403820,"owners_count":21742449,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","react-native","react-vue","vue"],"created_at":"2024-08-02T20:01:40.141Z","updated_at":"2025-05-04T21:30:57.962Z","avatar_url":"https://github.com/SmallComfort.png","language":"JavaScript","readme":"# React-Vue\n\nReact-Vue is designed to connect React and Vue. Which help you run Vue in React.\n\nThere are three uses.\n\n* Use the [reactivity system](#reactivity-system) of Vue to observer React component\n* Use the [react-vue-loader](#vue-component) to run Vue component in React application\n* Use the [react-vue-native-scripts](#native) to run Vue component in React Native\n\n### Reactivity System\nThanks to Vue's clear hierarchical design, we can easily pull out the reactivity system (9 KB gzipped), and drive React component rendering. \n\n```\nnpm install --save react-vue\n```\n\n```javascript\nimport React, { Component } from 'react';\nimport Vue, { observer } from 'react-vue';\n\nconst store = new Vue({\n  data () {\n    return {\n      count: 0\n    }\n  },\n  methods: {\n    increase () {\n      this.count ++;\n    }\n  }\n});\n\n@observer\nexport default class Demo extends Component {\n  render () {\n    return \u003ch1 onClick={store.increase}\u003e{store.count}\u003c/h1\u003e;\n  }\n}\n```\n[document](https://github.com/SmallComfort/react-vue/blob/dev/packages/react-vue/README.md) \n\n### Vue Component\nIntroduce [react-vue-loader](https://github.com/SmallComfort/react-vue-loader), which compile the Vue component into a React component. As you might think, your previously written Vue components can run inside the React component, and your React components can also run inside the Vue component.\n\n```\nnpm install --save react-vue react-vue-helper\nnpm install --save-dev react-vue-loader\n```\n\n```javascript\n// One.js\nimport React, { Component } from 'react';\nimport Two from './Two';\n\nexport default class One extends Component {\n  render() {\n    return \u003cTwo\u003eHello Vue\u003c/Two\u003e;\n  }\n}\n```\n\n```html\n\u003c!-- Two.vue --\u003e\n\u003ctemplate\u003e\n  \u003cdiv @click=\"count++\"\u003e\n    \u003cthree\u003e{{count}}\u003c/three\u003e\n    \u003cslot\u003e\u003c/slot\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\n  import Three from './Three'\n  export default {\n    components: { Three },\n    data () {\n      return {\n        count: 0\n      }\n    }\n  }\n\u003c/script\u003e\n```\n\n```javascript\n// Three.js\nimport React, { Component } from 'react';\n\nexport default class Three extends Component {\n  render () {\n    return \u003cspan\u003e{this.props.children}\u003c/span\u003e\n  }\n}\n```\n\n[document](https://github.com/SmallComfort/react-vue/blob/dev/packages/react-vue/COMPONENT.md)\n\n### Native\nIntroduce [react-vue-native-scripts](https://github.com/SmallComfort/react-vue-native-scripts), which start a server to compile the vue component into a react component.\n\n```\nnpm install --save react-vue react-vue-helper\nnpm install --save-dev react-vue-native-scripts\n```\n\nAll [React Native Components](https://facebook.github.io/react-native/docs/view.html) exists as built-in components in Vue, you can use react native components as following\n```html\n\u003ctemplate\u003e\n  \u003cview\u003e\n    \u003cview\u003e\n      \u003ctext\u003eHello react vue\u003c/text\u003e\n    \u003c/view\u003e\n    \u003canimated:view\u003e\n      \u003ctext\u003eHello animation\u003c/text\u003e\n    \u003c/animated:view\u003e\n  \u003c/view\u003e\n\u003c/template\u003e\n```\nThe similar JSX code is as follows\n```javascript\nimport React, { Component } from 'react';\nimport { View, Text, Animated } from 'react-native';\n\nexport default class Demo extends Component {\n  render() {\n    return (\n      \u003cView\u003e\n        \u003cView\u003e\n          \u003cText\u003eHello react native\u003c/Text\u003e\n        \u003c/View\u003e\n        \u003cAnimated.View\u003e\n          \u003cText\u003eHello animation\u003c/Text\u003e\n        \u003c/Animated.View\u003e\n      \u003c/View\u003e\n    );\n  }\n}\n```\n\u003e You can use all the [React Native API](https://facebook.github.io/react-native/) in Vue component.  The camelCased prop names need to use their kebab-case (hyphen-delimited) equivalents\n\n[document](https://github.com/SmallComfort/react-vue/blob/dev/packages/react-vue/COMPONENT.md) \n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSmallComfort%2Freact-vue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSmallComfort%2Freact-vue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSmallComfort%2Freact-vue/lists"}