A small react component creator

Usage no npm install needed!

<script type="module">
  import reactModulesTemplate from '';


React Modules Template

Easy create new react modules with this tool


npm install -g react-modules-template


react-module <ComponentName> [--pure]


react-module Login

This will generate a Folder named Login relative to your current path and three files: an empty Login.scss and another file named Login.jsx filled with starter code for exporting a module with custom css.

If you would like to generate a stateless component you can pass in the --pure flag after the componentName, this flag is optional. E.g: react-module TableRow --pure, this will generate a pure function with the name of TableRow with a corresponding style file and a test file.

Get started

Install the package globally and then run the --init command below.

react-module --init

This will step you through some configuration questions to make this package create files according to your project, in this init you can specify javascript extension, css extension and wheter or not to use ES6 classes.



Added the --pure flag to generate stateless components.


Changed the main file to be named index.extension instead of componentName.extension, because I hated that I had to import it like this import component from '/component/component'. Now I can only import it like this: import component from '/component'


Added functionality for a configuration file, added the --init flag when running to create the config file. Made it easier to customise to your own coding style and file structure.


Added a jest .js test file, the starter code only checks that it can be rendered, but it can be filled with more!


    --- index.[js|jsx]
    --- Login.test.js
    --- Login.[scss|css]