react-redux
valtio
Our great sponsors
- Appwrite - The open-source backend cloud platform
- Revelo Payroll - Free Global Payroll designed for tech teams
- Sonar - Write Clean JavaScript Code. Always.
- Onboard AI - Learn any GitHub repo in 59 seconds
- InfluxDB - Collect and Analyze Billions of Data Points in Real Time
react-redux | valtio | |
---|---|---|
75 | 46 | |
22,979 | 7,502 | |
0.1% | 1.7% | |
8.4 | 8.1 | |
8 days ago | 26 days ago | |
TypeScript | TypeScript | |
MIT License | 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-redux
-
20 Essential Parts Of Any Large Scale React App
react-redux : Integration with React
-
I am making a pizza app and I want that whenever I click on add my cart gets updated which is at the bottom of the page. Can anyone please help
You should think about using some client state management libraries like Redux. Redux gives you the possibility to encapsulate states and manipulate it through functions. https://react-redux.js.org/
-
What Are Signals?
`useSyncExternalStore` was shipped live in React 18.0 and is fully ready for production use.
Source: I'm the primary Redux maintainer, and worked with Andrew Clark of the React team to nail down the semantics and behavior needed by `useSyncExternalStore` in practice. They had the idea, but discussed a lot of the necessary use cases with us and other lib maintainers, and a lot of its internal implementation is directly related to how React-Redux's `useSelector` hook was implemented already.
I built the first working code that used it by prototyping React-Redux v8's switch from our own internal subscription handling to `useSyncExternalStore` instead and gave Andrew feedback:
-
React From Scratch
State Management with Redux
-
React Redux
Redux is a popular state management tool that can be used in conjunction with React to manage the state of an application. It works by implementing a unidirectional data flow, in which actions are dispatched to a central store, which then updates the state of the application and sends the updated state back to the components that need it.
-
Consuming a Rails API with a NextJs client
tl;dr; Previously here, I wrote about how to write a modern web application using Rails as a full-stack framework. Just writing HTML and Vanilla Javascript. Now we will go ahead creating a React client App using NextJs. The existing API has the following endpoints: GET /api/kit/products(.:format) POST /api/kit/products(.:format) GET /api/kit/products/:id(.:format) PATCH /api/kit/products/:id(.:format) PUT /api/kit/products/:id(.:format) DELETE /api/kit/products/:id(.:format) Enter fullscreen mode Exit fullscreen mode In the new project, we have the same screen as before: We have a lot of customized components: src/components/ βββ Form β βββ Actions.tsx β βββ Input.tsx β βββ index.tsx βββ Layout β βββ Page.tsx β βββ Sidebar.tsx β βββ index.tsx βββ Loading.tsx βββ LoadingOverlay.tsx βββ Notification.tsx βββ Products β βββ Form.tsx β βββ Sidebar.tsx βββ SearchList βββ Form.tsx βββ ListItem.tsx βββ index.tsx Enter fullscreen mode Exit fullscreen mode But our pages are simple and short. For example, take a look at the products page code: Highlights **NextJs is just a choice, not a requirement **The API made using Ruby on Rails is completely independent of the Next JS client application developed with NextJs. You could use any RESTfull client application to consume the existing API. In my project, I am using the NextJs project as a subfolder of my Rails repository, but you could put it anywhere. Why Next JS **I already worked with React Router and React Navigation, but when I knew the **Next/Router and all related features, as the **Next/Link**, I loved it. We can use partial load and caches. Get more info here. **Conventions **You can create your own convention for your own projects. But, in my opinion, it is beneficial to use a convention that is popular and validated in production by many other developers. Like Ruby on Rails, NextJs gives you a directory structure, core resources (link, routes, image, etc.) and rich documentation. **SSR **After to create a few projects using SPA, it doesnβt seem to me a good choice for big projects. So, for now, I am using SSR with NextJs. The main use of SSR is to improve the SEO, but like this approach to offer the a better UX. **React Query is the link between the Rails and NextJs **Working together with Axios (my code), it is a great option to consume the REST API (and GraphQL). You have the access to: isLoading, isError, data, error, and others. It is a very easy way to load data and rescue errors. **React Context **I donβt like https://react-redux.js.org/, it brings a complexity to the project that I donβt think soo is a good thing. But we can use the React Context and React Reducer to offer a store and events to manager states of the application. You can see the it on the project here https://github.com/raphox/rails-7-fullstack/tree/nextjs/frontend/src/contexts/products. *React components with namespace **It is something that I learned recently. I used it in my project to offer a way to override children of some components and prevent to set many properties throth the parent. Like in the following code: In the previous code, we have the namespace *SidebarPrimitive with nested Root, Header, and List components. I am using the Root component to wrap the content and I am passing the props to the respected child. **Tailwind **There are controversies related to it, but trust me, create a project using it and make sure that you donβt like or love it. Dependencies: https://tailwindcss.com/ βTailwind CSS works by scanning all of your HTML files, JavaScript components, and any other templates for class names, generating the corresponding styles and then writing them to a static CSS file.β https://www.radix-ui.com/docs/primitives/utilities/slot βMerges its props onto its immediate child.β https://tanstack.com/query/ βPowerful asynchronous state management for TS/JS, React, Solid, Vue and Svelteβ https://axios-http.com/ βAxios is a simple promise based HTTP client for the browser and node.js. Axios provides a simple to use library in a small package with a very extensible interface.β https://github.com/lukeed/clsx βA tiny (228B) utility for constructing className strings conditionally.β https://lodash.com/ βA modern JavaScript utility library delivering modularity, performance & extras.β https://react-hook-form.com/ βPerformant, flexible and extensible forms with easy-to-use validationβ https://github.com/jquense/yup βYup is a schema builder for runtime value parsing and validation. Define a schema, transform a value to match, assert the shape of an existing value, or both.β The project rails-7-fullstack/frontend at nextjs Β· raphox/rails-7-fullstack External references: https://www.typescriptlang.org/ https://www.radix-ui.com https://reactjs.org/docs/context.html https://medium.com/@kunukn_95852/react-components-with-namespace-f3d169feaf91
-
Redux vs Context, what exactly does Redux accomplish that context fails to do?
Sorry, that is correct. I was combining Redux toolkit with React Redux In my head.
-
What is the correct way to store a variable so that It is accessible to all components/pages?
if you have a more complex component hierarchy, and the component who receives the DB response is not on the top, you might consider introducing a State management tool, such as Redux: https://redux.js.org / https://react-redux.js.org
-
useSyncExternalStore() needs an update
FWIW I was actually the primary alpha tester for useSyncExternalStore - I prototyped using uSES in React-Redux v8, and worked with Andrew Clark to nail down what the final API and behavior should be.
-
I am sick and tired of react-redux. Who has some good alternatives?
Additionally, the idea that the props.todoAdded() version from connect automatically dispatched when called was always a source of confusion and led to lots of questions. So, Dan Abramov specifically suggested that we drop the idea of auto-binding as we were designing the hooks API to make it more clear what's actually happening, and we did.
valtio
-
Changelog #0023 β π οΈ Internal refactoring and improvements
We took inspiration from the many frameworks we worked with throughout our careers. And maybe surprisingly, Djangoβs ORM layer impacted our design choices and the API quite a bit. The resulting framework relies on Zod for schemas and validation and Valtio for React integration.
-
Is redux and thunks still used or are there other alternatives for it now?
Valtio is like simplified MobX
-
Why is building a UI in Rust so hard?
Even simpler than Zustand are state-atom libraries like jotai or recoil, or proxy based ones like valtio. Here's some discussion about the differences.
-
How to implement state management inside a simple JavaScript app
There is a package developed around this proxy concept called Valtio which is available for JavaScript, React, and so on... feel free to check and star it on Github.
-
What is being used right now for ioc/state-managment?
I'm switching from redux-saga to valtio (https://github.com/pmndrs/valtio) for now. It's simple and easy to use, everything's great so far.
-
Ask HN: What is your favorite front end state management solution?
I like valtio, works w/ React or just js. Has subscribe, derive, and more.
-
Explanation on how Redux or React Context could help and picking the best option
Jotai and Valtio are both also really good. Recently looked at Nanostore as well and has some similarity to Jotai and Recoil.
-
No-build TODO app using HTM + Preact
The state can be manipulated outside the React/Preact lifecycle too using vanilla JS. Persisting the app state to localStorage is also trivial.
-
React state management libraries in 2022
Have you looked at Valtio at all? Same author as zustand.
-
[Tutorial] Building a realtime multiplayer game using React & Conflict-free Replicated Data Types (CRDT) of Yjs.
If you want to use Yjs in your app, I highly suggest you use Valtio for state management, which has support for Yjs synchronization. Or if you want to use just Yjs for state, there is immer-yjs that gives you mutable semantics over immutable one of Yjs.
What are some alternatives?
redux - Predictable state container for JavaScript apps
axios - Promise based HTTP client for the browser and node.js
MobX - Simple, scalable state management.
zustand - π» Bear necessities for state management in React
Express - Fast, unopinionated, minimalist web framework for node.
jotai - π» Primitive and flexible state management for React
Immer - Create the next immutable state by mutating the current one
Recoil - Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.
leva - π React-first components GUI
rtk-query - Data fetching and caching addon for Redux Toolkit
recompose - A React utility belt for function components and higher-order components.
reselect - Selector library for Redux