![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@epeli/redux-hooks
Advanced tools
React Hooks implementation for Redux that does not suffer from the tearing / "zombie child component" problems. [Read more](#-why-yet-another-redux-hooks-implementation).
React Hooks implementation for Redux that does not suffer from the tearing / "zombie child component" problems. Read more.
It also implements performance optimizations eg. does not render when the map state function does not produce new value and allows advanced optimizations with memoizing and dependency arrays.
Written in TypeScript so types are baked in and always up to date.
npm install @epeli/redux-hooks
import {useMapState, useActionCreators} from "@epeli/redux-hooks";
const ActionCreators = {
inc() {
return {type: "INCREMENT"};
},
};
function Counter() {
const count = useMapState(state => state.count);
const actions = useActionCreators(ActionCreators);
return <button onClick={actions.inc}>{count}</button>;
}
Your components must be wrapped with the HooksProvider
import {HooksProvider} from "@epeli/redux-hooks";
ReactDOM.render(
<HooksProvider store={store}>
<Counter />
</HooksProvider>,
document.getElementById("app"),
);
Custom provider is required for now because the official react-redux bindings do not use subscriptions and it's impossible to implement Redux hooks without efficiently. Read more about it here.
useMapState()
Renders when returned value differ using Object.is()
checkuseSelect()
Renders when returned value differ using shallow equal checkuseActionCreators()
Bind object of action creators to dispatchuseDispatch()
Returns the plain dispatch-functionusePassiveMapState()
Like useMapState()
but does not subscribe to the
store eg. is executed only when the component renders.Please read the optimizations docs for details when to use these.
You can use createHooks()
factory to create custom typed version of the hooks
import {createHooks} from "@epeli/redux-hooks";
const AppHooks = createHooks<{foo: string}>();
function Foo() {
const foo = AppHooks.useMapState(state => state.foo);
return <div>String: {foo}</div>;
}
Codesandbox: https://codesandbox.io/s/github/epeli/typescript-redux-todoapp/tree/hooks
Github: https://github.com/epeli/typescript-redux-todoapp/tree/hooks
All the others I checked had the zombie child bug, poor performance or were missing TypeScript types.
Even the facebookincubator/redux-react-hook
one has the zombie bug which is stated in their FAQ. This one guarantees data flow top down like the official react-redux one does.
This also an experiment for the future of the react-redux:
https://github.com/reduxjs/react-redux/issues/1177#issuecomment-460097106
FAQs
React Hooks implementation for Redux that does not suffer from the tearing / "zombie child component" problems. [Read more](#-why-yet-another-redux-hooks-implementation).
We found that @epeli/redux-hooks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.