create react component template with javascript/typescript
Last updated a year ago by isaac-young .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @isaac.js/create-react-component 
SYNC missed versions from official npm registry.


A react component template generating tool

Save the trouble copy paste and rename when creating new react component

Support js ts css module styled components ...


  1. install: npm install -g @isaac.js/create-react-component
  2. use: create-react-component [-Options] MyComponent


Runing create-react-component -m MyComponent will generate a directory in the current working directory


  - MyComponent.tsx(or .jsx)

  - MyComponent.scss(this file is removed when you use styled components)

  - index.ts(or .js)


-l, --language [LANG]

Specify language(default to ts):

ts: typescript

js: javascript

-t, --type [TYPE]

Specify component type(default to c):

c: React.Component

p: React.PureComponent

s: React.SFC(Stateless Functional Component)


Specify whether to use css module or not, use css module if -m present

Note that if option -s present, this option is ignored!


Specify whether to use styled components, use styled components if -s present


Template for Component.scss

this file is removed when you use styled components

@charset 'utf-8';
.MyComponent {


Template for Component.tsx

import * as React from 'react'
import cStyle from './MyComponent.scss'

type MyComponentProps = {}
type MyComponentState = {}

export class MyComponent extends React.Component<MyComponentProps, MyComponentState> {
  public render() {
    return (
      <div className={cStyle.MyComponent}>MyComponent</div>

Template for index.ts

import { MyComponent } from './MyComponent'
export default MyComponent

Current Tags

  • 0.2.1                                ...           latest (a year ago)

5 Versions

  • 0.2.1                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Today 0
This Week 0
This Month 6
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |