0.2.1 • Published 6 years ago
@isaac.js/create-react-component-ts v0.2.1
create-react-component-ts
use @isaac.js/create-react-component
instead!
use @isaac.js/create-react-component
instead!
see @isaac.js/create-react-component
save the trouble copy paste and rename when creating new react component with typescript
Usage
- install:
npm install -g @isaac.js/create-react-component-ts
- use:
create-react-component-ts MyComponent
this will generate a directory in the current working directory
MyComponent
- MyComponent.tsx
- MyComponent.scss
- index.ts
Template
Template for Component.scss
@charset 'utf-8';
.__REPLACE__ {
}
Template for Component.tsx
import * as React from 'react'
import cStyle from './__REPLACE__.scss'
type __REPLACE__Props = {}
type __REPLACE__State = {}
export class __REPLACE__ extends React.Component<__REPLACE__Props, __REPLACE__State> {
public render() {
return (
<div className={cStyle.__REPLACE__}>__REPLACE__</div>
)
}
}
Template for index.ts
import { __REPLACE__ } from './__REPLACE__'
export default __REPLACE__