Conversation
…n & action.js file. Also removed some unnecessary files
ParthBarot-BoTreeConsulting
left a comment
There was a problem hiding this comment.
@YashKalaria-BTC @ShaileshPrajapati-BTC Please review my comments, I think we are all good.
Changes
- Adding code to generate new functional component for Web as well as native.
- All functions changed to use
=>syntax for default binding. - Removed code for actionCreators and added
.action.jsfor simplicity.
Please confirm this.
| const templateDirectory = path.join(__dirname, '..', 'templates', 'redux-core'); | ||
| const generatedDirectory = path.join(ROOT_PATH, reduxCoreDirectory); | ||
|
|
||
| if (!fs.existsSync(generatedDirectory)) { |
There was a problem hiding this comment.
@YashKalaria-BTC Why is this deleted?
| template: path.join(templateDirectory, 'root-reducer.js'), | ||
| generated: path.join(generatedDirectory, 'root-reducer.js') | ||
| }, | ||
| createAction: { |
There was a problem hiding this comment.
@YashKalaria-BTC Same as above.
| template: path.join(templateDirectory, 'test', 'template.container.spec.js'), | ||
| generated: path.join(generatedDirectory, 'test', `${name}.container.spec.js`) | ||
| }, | ||
| action: { |
There was a problem hiding this comment.
@YashKalaria-BTC It seems we removed the createAction JSON object and added this to simplify, I would like to understand this change.
| /* | ||
| Import all the actions you wish to expose to the view here. | ||
| */ | ||
| } from './TEMPLATE_KEBAB_CASE_NAME.reducer'; |
There was a problem hiding this comment.
@YashKalaria-BTC I believe this was an error in the original code OR we change the approach to take from action JS?
| */ | ||
| } from './TEMPLATE_KEBAB_CASE_NAME.action'; | ||
| export const mapStateToProps = ({ TEMPLATE_LOWER_CAMEL_CASE_NAMEReducer }) => { |
There was a problem hiding this comment.
@YashKalaria-BTC Same as above, we are changing as we need const right?
| */ | ||
|
|
||
| const reducerName = 'TEMPLATE_KEBAB_CASE_NAME'; | ||
| import { actionType } from './TEMPLATE_KEBAB_CASE_NAME.action'; |
There was a problem hiding this comment.
@YashKalaria-BTC I assume that this './TEMPLATE_KEBAB_CASE_NAME.action' will be replaced by a real filename like - './myNewComponentName.action' in the newly generated component file.
| /* | ||
| Import all the actions you wish to expose to the view here. | ||
| */ | ||
| } from './TEMPLATE_KEBAB_CASE_NAME.action'; |
There was a problem hiding this comment.
@YashKalaria-BTC Same as per my comment in the native container file, we want to take actions from our new action file so we are changing this.
@YashKalaria-BTC Please check the tests, if we have added test code for this change. Let us ensure that all the tests pass. |
Changed everything according to ES6. Added functional component option & action.js file. Also removed some unnecessary files.