Day 41 of 100 Days Of Code
Day 41: September 3, Monday
Today ‘s Progress: I continued work on Redux Introduction to the Redux Challenges.
Thoughts: Only two more Redux before I go on to React and Redux (I know lucky me) ambiguous instructions hardly no relevant examples I don’t think these challenges are a good way to learn these two frameworks.
Resources used:
const INCREMENT = 'INCREMENT'; // define a constant for increment action types
const DECREMENT = 'DECREMENT'; // define a constant for decrement action types
const counterReducer = (state = 0, action) => {
switch(action.type){
case INCREMENT:
return state + 1;
break;
case DECREMENT :
return state -1;
break;
default:
return state;
}
}; // define the counter reducer which will increment or decrement the state based on the action it receives
const incAction = () => {
return {
type : INCREMENT
}
}; // define an action creator for incrementing
const decAction = () => {
return {
type: DECREMENT
}
}; // define an action creator for decrementing
const store = Redux.createStore(counterReducer); // define the Redux store here, passing in your reducers
Worst one yet!!! poor instructions and no clear examples expects you to look at past challenges..
Link(s) to work
- Continued work on Introduction to the Redux Challenges (trying to) learn Redux.
Introduction to the React Challenges
- PassedRegister a Store Listener
- PassedCombine Multiple Reducers
- PassedSend Action Data to the Store
- PassedUse Middleware to Handle Asynchronous Actions
- PassedWrite a Counter with Redux
- PassedNever Mutate State
- PassedUse the Spread Operator on Arrays
All code is in GitHub FCC-Introduction to the redux Challenge.
Written on September 3, 2018