Skip to content

Conversation

@KalariaYash
Copy link

Changed everything according to ES6. Added functional component option & action.js file. Also removed some unnecessary files.

…n & action.js file. Also removed some unnecessary files
Copy link

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

  1. Adding code to generate new functional component for Web as well as native.
  2. All functions changed to use => syntax for default binding.
  3. Removed code for actionCreators and added .action.js for simplicity.

Please confirm this.

const templateDirectory = path.join(__dirname, '..', 'templates', 'redux-core');
const generatedDirectory = path.join(ROOT_PATH, reduxCoreDirectory);

if (!fs.existsSync(generatedDirectory)) {

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?

template: path.join(templateDirectory, 'root-reducer.js'),
generated: path.join(generatedDirectory, 'root-reducer.js')
},
createAction: {

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.

template: path.join(templateDirectory, 'test', 'template.container.spec.js'),
generated: path.join(generatedDirectory, 'test', `${name}.container.spec.js`)
},
action: {

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';

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 }) => {

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';

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';

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.

@ParthBarot-BoTreeConsulting

@YashKalaria-BTC @ShaileshPrajapati-BTC Please review my comments, I think we are all good.

Changes

  1. Adding code to generate new functional component for Web as well as native.
  2. All functions changed to use => syntax for default binding.
  3. Removed code for actionCreators and added .action.js for simplicity.

Please confirm this.

@YashKalaria-BTC Please check the tests, if we have added test code for this change. Let us ensure that all the tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants