![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Declarative async outerware for Redux
This library enables you to declaratively specify effects in Redux reducers. You can use it to express in reducers not just what should happen, but also, what should happen next, while keeping reducers pure.
Using redux-funk, you can put all the logic and state management stuff in one place—the reducer—so you don't have to dig through multiple files to find out what happens when the UI dispatches a certain action.
This library combines (in my opinion) the best ideas from Redux Loop, redux-side-effect, and a few other libraries. It's pretty similar to Redux Loop, but the implementation is much simpler and shorter, and it enables you to program with reducers without having to worry about lifting effects.
npm install redux-funk
Add declarative effects to your reducer. In this example, dispatching {type: 'INCREMENT_ASYNC'}
increments the counter after one second.
// reducer.js
import { combineReducers } from 'redux'
import { call, coalesceFunks } from 'redux-funk'
// exporting for testing
// returns promise for an action
export const incrementAsync = () => new Promise(resolve => {
setTimeout(() => resolve({type: 'INCREMENT'}), 1000)
})
const counter = (state = 0, action) => {
switch (action.type) {
case 'INCREMENT':
return state + 1
case 'INCREMENT_ASYNC':
// the funk `[incrementAsync, []]`
// is a declarative effect
// that says "call incrementAsync with no arguments"
call(action, [incrementAsync, []])
return state
default:
return state
}
}
// coalesceFunks collects any funks you've called
// and adds them to `state.funks`
// note the `funks` reducer below which initializes that part of the state
const rootReducer = coalesceFunks(combineReducers({
counter,
funks: () => []
}))
export default rootReducer
Advantages of adding funks to the state are that you have the option to inspect them, test them, or add your own logic for handling them.
To run these funks whenever the state changes, you can use runFunks
:
// store.js
import { runFunks } from 'redux-funk'
import { createStore } from 'redux'
import reducer from './reducers'
const store = createStore(
reducer
)
runFunks(store)
Here's what runFunks
does:
You can use
redux-funk
withoutrunFunks
. Here are examples of why you might want to do this:
See redux-funk-examples.
FAQs
declarative async outerware for Redux
The npm package redux-funk receives a total of 222 weekly downloads. As such, redux-funk popularity was classified as not popular.
We found that redux-funk 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
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.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.