-
Notifications
You must be signed in to change notification settings - Fork 0
Refactored code according to our needs. #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…n & action.js file. Also removed some unnecessary files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.js
for simplicity.
Please confirm this.
} | ||
|
||
function getReduxCoreDirs(reduxCoreDirectory) { | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YashKalaria-BTC Why is this deleted?
@@ -38,47 +34,11 @@ function getReduxCoreDirs(reduxCoreDirectory) { | |||
rootReducer: { | |||
template: path.join(templateDirectory, 'root-reducer.js'), | |||
generated: path.join(generatedDirectory, 'root-reducer.js') | |||
}, | |||
createAction: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YashKalaria-BTC Same as above.
@@ -120,6 +86,10 @@ function getReactComponentDirs(name, directory, native, redux) { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.