Generate one or multiple boilerplate components within src
with the following files:
src
├── components
├── <ComponentName>
├── index.js
├── <ComponentName>.js
├── <ComponentName>.css
Note: the scripts are bash scripts and may not run on Windows machines. If that is the case, use Git Bash.
Install
npm install -g create-react-redux-component
Example
create-react-redux-component Test
will create
src
├── components
├── Test
├── index.js
├── Test.js
├── Test.css
where the individual files look like the following:
index.js
; ;
Test.css
/* empty */
Test.js
;;// import { action } from './place'; // this is boilerplate for an action import; replace as needed; const mapStateToProps = { return ...state ;}; const mapDispatchToProps = { // the following is the boilerplate, replace // with real actions as needed; don't forget // to import them! /* return { action: element => dispatch(action(element)) } */ return null; // delete this once the above is implemented}; { return <div>This is a component called Test</div>; } const Test = ConnectedTest; ;
License
MIT © Haldun Anil