react-community-tools-practices-cheatsheet
reselect
react-community-tools-practices-cheatsheet | reselect | |
---|---|---|
10 | 46 | |
325 | 18,999 | |
- | 0.0% | |
0.0 | 9.6 | |
over 1 year ago | 5 days ago | |
JavaScript | TypeScript | |
- | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
react-community-tools-practices-cheatsheet
- State Management in React Applications
-
How I write React after 8 years
Eh, there was entirely valid reasons for the backlash :)
Redux _was_ overused in the first couple years. The original patterns _were_ very boilerplate-y. There _are_ a lot of other good tools for varying use cases that overlap with things that people have used Redux for: Context for prop drilling, React Query / Apollo for data fetching, Zustand/Jotai/Mobx/five-million-other-libs for state management.
Redux will never be the "must use this" lib again the way it was there for a couple years.
And that's a _good_ thing, because folks should take time to think about what problems they actually need to solve in their apps and pick the tools that work best for those problems.
But it's also true that Redux _is_ still a useful tool, and that RTK has addressed the pain points in using Redux. So, still very much a viable choice today, and the positive feedback we get on RTK daily shows that.
Really, the bigger issue today is that a lot of folks don't seem to understand the technical differences, tradeoffs, and intended use cases between a lot of these tools.
I wrote an extensive post describing the differences between Context and Redux to try to help with that:
- https://blog.isquaredsoftware.com/2021/01/context-redux-diff...
I've also been trying to start up a community-driven site to list common tools for various use cases (state management, styling, build tools, data fetching, etc), to act as a resource to help clarify this sort of confusion:
- https://github.com/markerikson/react-community-tools-practic...
Sadly I haven't had time to push it forward myself due to all the other responsibilities and tasks on my todo list, but hopefully at some point we can get enough info filled in for it to be a real resources that we can point people to.
-
Redux is Poison
In fact, I am literally trying to put together a community-driven site that would list commonly used tools for use cases like state management and styling, and describe their tradeoffs, specifically because I want people to make informed decisions.
-
UIs are not pure functions of the model
Good question!
The really short answer is: mostly looking at NPM download stats, Github "depended by" numbers, and random polls on Twitter.
Which are all _horribly_ flawed metrics, but they're also all we have to go by.
I wrote a couple longer comments on Reddit a while back that went into more details on some of the numbers and the potential flaws in using them:
- https://www.reddit.com/r/reactjs/comments/lcgqnd/state_manag...
- https://www.reddit.com/r/reactjs/comments/skbyb1/the_most_po...
and unfortunately you asking me about this is tempting me to turn those comments into a blog post with some additional thoughts :)
I'll definitely agree that Redux usage has peaked in _relative_ terms, although as you can see from the download numbers it seems to still be growing in _absolute_ terms. Also it's entirely possible that fewer new projects are choosing Redux.
Then again, how do we even count "usage" in the first place? I've seen Web3 app boilerplate repos that include Redux Toolkit. If 1000 people clone that repo and play with it, how do we compare that usage conceptually vs one app using Mobx that's been around for years and has a bunch of developers working on it daily?
As I've pointed out in a number of podcasts and articles: I'm not trying to convince people they _must_ use Redux, or even that they _should_ use Redux. I just want people to be aware that modern Redux is way easier than legacy Redux, that Redux _is_ still widely used and is a viable choice, and what some of the tradeoffs are when using Redux or any other state management library.
I've actually been trying to get the community to come together and work on a centralized site that would list tools in different use cases and categories such as state management, styling, data fetching, and build tooling, describe purpose / use cases / tradeoffs for each tool, and have that as a recognized resource for people to use when researching what to use for a project. You can see the original RFC discussion and prototype site here:
- https://github.com/markerikson/react-community-tools-practic...
- https://react-community-tools-practices-cheatsheet.netlify.a...
Sadly I haven't had time to push this forward, and it needs to have more people involved and helping fill out content on the various topics (not just me).
-
Building first React project, and lost on State Management
Fortunately, we're starting to make some headway on https://github.com/markerikson/react-community-tools-practices-cheatsheet/discussions/1 ! We recently got a PR adding a page covering the three Poimandres libs (Zustand/Jotai/Valtio), someone's filling out pages on styling approaches, etc.
-
Recap from Reactathon, if you missed the conference
(I will say this is the exact kind of guidance I'd like to have in the "React Community Tools" site I still want to build out as a resource, and I'm hopeful that we can get some content filled out and momentum behind that site later this year.)
-
Should we be teaching Redux in 2022?
Early last year, I proposed creating a "React Community Tools and Practices" resource site. The idea was to provide curated written guidance on the different tools and techniques that React devs commonly use to solve various problems, describe the purpose and tradeoffs of each tool, and give some general guidance on how to decide on what tool best solves your use case.
-
React State Management
Background: https://github.com/markerikson/react-community-tools-practices-cheatsheet/discussions/1
- What are the biggest issues you see with React in its current form?
- Top libraries to know about
reselect
- Redux Toolkit 2.0: new features, faster perf, smaller bundle sizes (plus major versions for all Redux family packages!)
-
Redux Toolkit 2.0: new features, faster perf, smaller bundle sizes, and more
- Throws better errors in an RSC environment
- https://github.com/reduxjs/react-redux/releases/tag/v9.0.0
## Reselect 5.0:
- Switches to a new `weakMapMemoize` memoizer as default
- Renames `defaultMemoize` to `lruMemoize`
- Allows passing memoizer options direct to `createSelector`
- Many TS improvements
- https://github.com/reduxjs/reselect/releases/tag/v5.0.1
## Redux Thunk 3.0:
- Drops the default export and switches to named exports ( `{thunk, withExtraArgument}` )
- https://github.com/reduxjs/redux-thunk/releases/tag/v3.1.0
This has been a _huge_ year-long development effort!
We're thrilled to get these improvements out. The tooling and bundle improvements will help all users, and we think the features and TS changes will improve the Redux dev experience significantly.
Thank you SO MUCH to everyone who has contributed or helped test out the work!
Please file bug reports for the inevitable issues that pop up post-release!
but now I'm going off on a conf trip and going to take a very well-earned break from Redux work for December :)
-
45 NPM Packages to Solve 16 React Problems
reselect -> For making faster queries to store.
-
Top 7 Libraries for Blazingly Fast ReactJS Applications
Reselect solves this problem by memorizing the values and only passing what’s necessary.
-
What's the benefit of Redux?
In addition, diagnosing bugs in how data flowed through the application (where data originated from, how it was changed, etc.) was always super painful because I had to backtrack through selectors referencing selectors referencing selectors. And updating high-level selectors risked breaking something else down the line (even with 100% business logic coverage this was a problem). (This may be chalked up to improper usage of reselect, but I'm curious to hear your thoughts. Is this a common problem?)
-
20 Essential Parts Of Any Large Scale React App
reselect : Selector library to optimize your store access
-
Revolutionize Your React App with Redux: A Beginner's Guide to Simplifying State Management(PART 2)
Reselect documentation:
-
What is memoization in React
Applying memoization to TypeScript and ReactJS is relatively straightforward. There are several libraries available that provide memoization functionality, such as memoize function from Lodash, reselect or hooks from ReactJS. These libraries can be installed using NPM or Yarn and used in your TypeScript and ReactJS projects.
-
ThreeJS project wrapped in Redux for State Management
Generally, all you would need is to have your redux store provider at the very top level of your application (You could also only wrap the components that you want to have this data available to). Then, any component rendered inside that provider can get access to the redux store. The suggested approach ever since hooks were released is to use `useSelector` and `useDispatch` within your component to get the state data that you need. Using a selector library like Reselect is prevalent and keeps your data selection tidy & handles memoization for you.
-
20 Best Libraries and Tools for React Developers
Reselect is a library for creating memoized “selector” functions. Commonly used with Redux, to slice state and provide just the necessary subtree to a React component.
What are some alternatives?
redux - A JS library for predictable global state management
recompose - A React utility belt for function components and higher-order components.
use-context-selector - React useContextSelector hook in userland
Immer - Create the next immutable state by mutating the current one
ducks-modular-redux - A proposal for bundling reducers, action types and actions when using Redux
egui - egui: an easy-to-use immediate mode GUI in pure Rust
redux-toolkit - The official, opinionated, batteries-included toolset for efficient Redux development
react-handbook - ⚛🤌 Modern approaches to architecture and feature development in React apps.
react-redux - Official React bindings for Redux
freeCodeCamp - freeCodeCamp.org's open-source codebase and curriculum. Learn to code for free.
effector-react - Business logic with ease ☄️