Skip to content
Generate React components by replicating your own
Branch: master
Clone or download

Latest commit

Latest commit 0ad333c Mar 8, 2019


Type Name Latest commit message Commit time
Failed to load latest commit information.
src Adds support for .mdx (#25) Mar 8, 2019
test Alternative pattern for matching local imports (#22) May 31, 2018
.babelrc Initial commit Jun 4, 2017
.editorconfig Initial commit Jun 4, 2017
.eslintignore Initial commit Jun 4, 2017
.eslintrc Initial commit Jun 4, 2017
.flowconfig Initial commit Jun 4, 2017
.gitignore Replace contents in JSON files (#8) Jun 26, 2017
.travis.yml Initial commit Jun 4, 2017
LICENSE Initial commit Jun 4, 2017 Update Apr 11, 2018
index.d.ts Rename performReplication to replicate Sep 22, 2017
index.js Exposed functions to add support for editor extensions (#11) Sep 22, 2017
package.json 0.4.0 Mar 8, 2019
yarn.lock Initial commit Jun 4, 2017


Generated with nod NPM version Build Status Coverage Status

Tool for generating React components by replicating your own.
It's intended to work no matter how your file structure is.


 Are you looking for a VS Code extension? Try vscode-generact.

It already works with boilerplates such as create-react-app (above example), react-boilerplate, react-starter-kit and ARc (ok, I'm self-promoting here 😆). So, most likely this will work for you with your current project.


$ npm install -g generact


Facebook poll Facebook poll

I usually work on different projects with different file structures. Whenever I needed to create a new component, the approach I used was to copy and paste a similar or very basic component and start writing the new component from it. Talking with other developers, this seemed like a very common process.

However, I've never been satisfied with that. It looked like I was doing a robot job. So why not create a robot to do that?


$ cd ~/my-projects/my-react-project
$ generact

That will scan ~/my-projects/my-react-project for components to replicate.

Specify another root path to find components

If you want to replicate components from another directory, you can do that by using root option:

$ generact --root relative/or/absolute/path/to/any/react/project

Specify component path to replicate

generact will probably find all component files inside the root path automagically (using list-react-files). But, if it doesn't, you can still pass in the component path:

$ generact relative/or/absolute/path/to/component.js


PRs are welcome.

Use npm run watch while coding.


MIT © Diego Haz

You can’t perform that action at this time.