-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Proposal: useReduxHooks #1341
Comments
I suggest reading through #1252. All of these suggestions have been addressed and discussed in detail there in some form. |
@timdorr |
We discussed that in the linked issue. The correct, idiomatic way to use Hooks is to provide them as piecemeal, composable functions, not as one big "mega-function". If you want to consolidate those things together, you should just use |
I've not found (but I can skip I was not in touch with process all that time ...).
Well, it's clear. So, thanks for dialog and sorry for disturb. |
Hi, guys. I tried to implement react-redux-hooks for my project.
I don't want to offer whole implementation, but I guess approaches could be interesting.
useReduxHooks
The main idea of
useReduxHooks
to aggregatecontext
,store.subscription
andupdate triggering
inside one hook that allows to useuseAction
anduseSelector
multiple times inside component without performance suffering.useAction
The main idea of
useAction
is to combineuseCallback
andcompose(dispatch, action)
, with some event-processing logic.useSelector
The idea is to declare dependencies and do not use
state
-point. Also I propose to useObject.is
to detect state changes. It will motivate developers to usememorized
selectors to not loose performance.Maybe
useSelector
could havestate
-point interface:useReduxStore
- simple wrapper underuseContext
to provide components withstore
.useReduxAction
anduseReduxSelector
are stand-alone versions ofuseAction
anduseSelector
(could be imported fromreact-redux
directly) and could be used when React component doesn't require optimization:The text was updated successfully, but these errors were encountered: