redux-define | Define action constants for Redux | State Container library
kandi X-RAY | redux-define Summary
kandi X-RAY | redux-define Summary
Define action constants for Redux
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of redux-define
redux-define Key Features
redux-define Examples and Code Snippets
Community Discussions
Trending Discussions on redux-define
QUESTION
I need a little help with this redux problem that I am encountering. Here, I have an APP.js code that called the action from a file called duck.js.
...ANSWER
Answered 2019-Dec-03 at 15:12So there are at least two issues here, I'll try to explain them one by one, I'm not sure how these frameworks you're using interact but here are a few points that will at least fix your issue.
Your reducer is trying to extract
{ baseCurrency }
but this is not a property of your action. You instead need to extract thepayload
here, like this:{ payload }
, thispayload
value will contain yourbaseCurrency
, and to properly save it in the reducer you should return{ ...state, baseCurrency: payload }
Your selectors are trying to read directly from the
state
variable, but this one contains your reducers under the keys you sent tocombineReducers
, in your case you called your reducerreducer
, thus you need to select state like thisstate => state.reducer.baseCurrency
See my fork of your Sandbox where I've fixed the baseCurrency case for you: https://codesandbox.io/s/todoapp-with-redux-and-normalized-store-ih79q
QUESTION
Given that in a file called goose.js I have exported a reducer as such:
...ANSWER
Answered 2019-Dec-03 at 10:33react-redux Provider
is taking a store not a reducer.
You need to create the store with use of createStore
function from redux library and pass to it your reducer. And after that you can pass the created store to the Provider
.
Have a look at the basic example in redux documentation.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install redux-define
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page