Skip to content

🔧 Convert your React Class Component to Functional Component and vice-versa

License

Notifications You must be signed in to change notification settings

chrvadala/react-refactor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-refactor

Build Status Beerpay

How many times have you converted a React Class component to a React Functional component and vice-versa? It’s a boring task, and we know... "developers don’t like boring tasks". Thanks to React Refactor you can convert any React component from and to Class component.

It's made with Babel Babylon and thanks to string replacing it’s able to instantly convert your component to the opposite kind of component that you provided.

React Refactor is available in three different packages: Library, CLI, Web Interface

Library

npm Downloads

The package react-refactor offers methods to programmatically convert a component. You can use it to make new useful utilities that integrate this ability.

const {execRefactor} = require('react-refactor')
let {output} = execRefactor(source)

CLI

npm Downloads

You can globally install the package react-refactor-cli and use it to convert your component on the fly.

$ yarn global add react-refactor-cli
$ react-refactor [--output <filename>] <filename>

Web interface

You can avoid installing anything and convert your component through the web interface available at https://chrvadala.github.io/react-refactor/

Changelog

  • v0.0 - Preview version
  • v1.0 - First stable version

Run tests

yarn install
yarn run bootstrap
yarn build
yarn test
yarn run clean

Contributors