NOJIRA: refactor redux connect to hooks #268
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this do?
It modernizes from older-style pattern React-Redux
connect
API to modernuseSelector/useDispatch
hooks.Why are we doing this? (with JIRA link)
Moving to
useSelector
anduseDispatch
leads to cleaner, more maintainable, and performant application, aligning with the modern React development paradigms. More precisely:useSelector
anduseDispatch
hooks allow you to extract state and dispatch actions directly within your component, which can make the component logic easier to follow compared to the connect function which introduces additional complexity with higher-order components.mapStateToProps
andmapDispatchToProps
functions. The whole HOC container component can be removed.For more details please check: https://redux.js.org/tutorials/videos#modernizing-a-legacy-redux-application-with-react-hooks.
How should this be tested? Do these changes have associated tests?
No associated tests needed.
Dependencies for merging? Releasing to production?
No dependency.
Has the application documentation been updated for these changes?
Not necessary.
Did someone actually run this code to verify it works?
@spirosdi using herbarium.collectionspace.org as backend.