Skip to content
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

Components #4

Open
1 of 2 tasks
matiboy opened this issue Aug 10, 2017 · 9 comments
Open
1 of 2 tasks

Components #4

matiboy opened this issue Aug 10, 2017 · 9 comments

Comments

@matiboy
Copy link

matiboy commented Aug 10, 2017

  • Create a new component, an number input, used to set the in/decrement step. So I can select "5" and the + button will increase by 5. This component should not be within Counter but rather a sibbling of Counter. Given that restriction, propose and justify the level at which binding will occur, both on redux and on props for the 2 components
  • do not make use of name="increment" etc to differentiate between the buttons. Propose one or several better solutions (e.g. using .bind)
@mingsterism
Copy link

Problem 1
Partially tried to do this in counter1.js, however, not complete. Dont understand this sentence,
justify the level at which binding will occur, both on redux and on props for the 2 components

Will look over weekend.

@matiboy
Copy link
Author

matiboy commented Aug 11, 2017

@mingsterism Is that all on the live code thing?

@mingsterism
Copy link

I pushed all my code that day to a new fork. branch name: ming-branch

@matiboy
Copy link
Author

matiboy commented Aug 12, 2017

@mingsterism Great, thanks, I'll go through

@mingsterism
Copy link

mingsterism commented Aug 12, 2017

@matiboy fixed component with increment. Kindly refer to branch : ming-counter-increment-fixed
Cheers.
I spent some hours time to understand the flow of data and state management that you used.
Tried to create a solution that didnt change the flow of data too much.

@matiboy
Copy link
Author

matiboy commented Aug 12, 2017

@mingsterism
Strongly suggest you use this Chrome extension: https://github.com/zalmoxisus/redux-devtools-extension#usage

Way better than making console logs to dump the state :)

@mingsterism
Copy link

@matiboy thanks. Will take a look at that.

@matiboy
Copy link
Author

matiboy commented Aug 12, 2017

@mingsterism
You'll probably find the code on my branch mat to be interesting in terms of separating smart components (connect to redux, but don't do DOM) from dumb components (DOM, must be given all props, has no idea where data comes from or goes to).

@matiboy
Copy link
Author

matiboy commented Aug 12, 2017

@mingsterism
Latest commit also shows an example of creating your own HOC; the power of HOCs being amongst other things, to be reusable. So this HOC eventLogger can be used within compose to just add a console log to the handlers (methods) that you want (just pass their name)

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

No branches or pull requests

2 participants