@fannasd/crc
v1.1.6
Published
Simple npm package for creating function components and hooks with their test files in javascript or typescript.
Downloads
17
Maintainers
Readme
React Create Component
Simple npm package for creating function components and hooks with their test files in javascript or typescript.
install via npm
npm i -g @fannasd/crc
Creating a component
crc c MyReactComponent
//with css
crc c MyReactComponent css
//with scss
crc c MyReactComponent scss
MyReactComponent
├── MyReactComponent.test.js
├── MyReactComponent.scss
└── index.js
--------------------------------------------------------------------
import './MyReactComponent.scss';
function MyReactCompnent(props){
return (<div>MyReactCompnent Component Working</div>);
}
export default MyReactCompnent;
---------------------------------------------------------------------
Change template to typescript
//default template is javascript crc config js
crc config ts
crc c MyReactComponent scss
MyReactComponent
├── MyReactComponent.test.tsx
├── MyReactComponent.scss
└── index.tsx
------------------------------------------------------------------------
import React from "react";
import './MyReactComponent.scss';
interface Props extends React.HTMLAttributes<HTMLElement> {
}
const MyReactCompnent: React.FC<Props> = (props)=> {
return (<div>MyReactCompnent is working!</div>);
}
export default MyReactCompnent;
------------------------------------------------------------------------
Creating a hook
crc h useTheme