The `vue-to-react` package is a command-line interface (CLI) tool designed to transform Vue components, including both JSX and Single File Components (SFCs), into React components. It aims to assist developers in migrating existing Vue.js codebases to React by automating the conversion of component structure and partial logic. The package reached its 1.0.0 version but development appears to have ceased around 2018, indicating an abandoned status rather than active development. Key differentiators included its attempt to support both Vue JSX and SFCs, and its mapping of a limited set of Vue lifecycle methods to their React equivalents. However, it has significant limitations, explicitly stating it does not support advanced Vue features like object/array syntax for class/style bindings, `watch` or `components` props for JSX components, custom directives, filter expressions, and certain `v-bind`/`v-on` shorthands. Its utility is thus restricted to very simple component structures.
npm install vue-to-reactVerified import paths — ran on the pinned version, not inferred.
Demonstrates the global installation of the `vue-to-react` CLI tool and how to use it to transform a basic Vue Single File Component (`.vue` file) into a React component, specifying input, output directory, and file name.
Refactor Vue components to use a computed property that returns the desired class string, then bind `v-bind:class="computedClasses"`.
Refactor Vue components to use a computed property that returns the desired style object, then bind `v-bind:style="computedStyle"`.
Manually rewrite `watch` logic in the transformed React component, typically using `componentDidUpdate` lifecycle method or `useEffect` hooks in functional components.
For Vue JSX components, ensure all sub-components are globally available or manually integrate them into the resulting React component after transformation.
Avoid using unsupported directives or manually refactor the associated logic in the resulting React component. Check the documentation for the complete list of supported directives.
Use the full `v-bind:` and `v-on:` syntax in Vue Single File Components before running the transformation (e.g., `v-bind:prop="value"` and `v-on:event="handler"`).
Remove custom directives and filter expressions from Vue components before transformation, or manually implement their equivalent logic in the resulting React component after conversion.
Ensure the package is installed globally by running `npm install -g vue-to-react`. If the issue persists, check your `npm root -g` path and verify it's added to your system's PATH.
Verify that the `--input` (`-i`) path is correct and points to an accessible Vue component file (e.g., `my/vue/component.vue` or `my/vue/component.js`). Ensure file extensions are included.
Refer to the 'Attention' section within the `vue-to-react` documentation to identify unsupported Vue features (e.g., complex class/style bindings, watch properties, specific directives). Refactor your Vue component to use only supported features before attempting transformation.
No dependency data recorded yet.