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

how to bind some arg to all actions ? #95

Open
lyquocnam opened this issue Apr 6, 2016 · 1 comment
Open

how to bind some arg to all actions ? #95

lyquocnam opened this issue Apr 6, 2016 · 1 comment

Comments

@lyquocnam
Copy link

hi everyone, i have a problem.
i want to send some objects to actions before component render. how can i do that ?
my currently solution:
<Button onClick={actions.bind(null, data)} label="OK"/>
but this i have to bind each action on my component, that's too bad.
how can i bind data object to all actions in once?
thanks so much !

@markshust
Copy link
Contributor

I believe you need a container component to link actions down to presentational components. I've found it pretty consistent to have a related container component for practically every single presentation component that needs to manage a state or link up an action. Then, you pass the actions as props using useDeps. It seems like overkill in theory, but in practice just about all of the container components are needed to properly manage the data aspect of the components.

Hope this helps? 😬

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