generalui / hooks-for-redux Goto Github PK
View Code? Open in Web Editor NEWmodular redux - in half the code
License: MIT License
modular redux - in half the code
License: MIT License
I find articles as a way to promote open source work a pretty effective way of doing it, good job!
Any plans adding TS types for the folks? ๐
I'm trying to refactor from redux toolkit, but prefer the immer syntax. Trying to figure out a way to use this same pattern with immer syntax reducers.
I've tried swapping the combineReducers function in hooks-for-redux
with redux-immer
https://www.npmjs.com/package/redux-immer and adding immer, but that wasn't working. Kept getting an error that it couldn't find immer's produce method.
The goal here is to allow people to incrementally convert an existing Redux project to H4R. To start, someone would just replace the Redux createStore with the H4R createStore. In order to do this, H4R's createStore needs to support the same API as Redux (it doesn't currently).
After solely replacing Redux's createStore with H4Rs, the rest of the project should still run and work unchanged. From there, the people doing the migration could incrementally either add createReduxModule calls for new slices or start replacing existing Redux state with createReduxModule.
import { setStore, createStore } from "hooks-for-redux";
export default setStore(createStore((state) => state));
How to setup persist data to localStorage
Hi, apologies if this is the wrong place for this, but I am wondering if there is a way to access the actions that have been called on a store with this library? Traditional redux has a getActions
method available on the store, but I'm not seeing that with this library.
We are trying to test that (non-visible) actions have been called on the store as a side effect in one of our components using Jest.
Now that we have #9 custom selectors, we also need to add typescript support for them. The ReactReduxHook
type in the index.d.ts
file needs to be updated to take the optional, custom selector as input and, if provided, return the same time the custom-reducer returns.
I'd like to add the ability to optionally select a subset of the H4R redux slice and only re-render when that subset changes:
const [use, {...}] = createReduxModule('example', {foo: 1, bar: 2}, {...})
const MyComponent = () => {
const foo = use(({foo}) => foo) // doesn't re-render if bar changes
return ...
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.