File tree Expand file tree Collapse file tree 5 files changed +34
-1
lines changed Expand file tree Collapse file tree 5 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,17 @@ import './App.css'
44function App ( ) {
55 return (
66 < >
7- < h1 > welcome to redux</ h1 >
7+ < div className = 'container' >
8+
9+ < h1 > Increment/Decrement counter</ h1 >
10+ < h4 > using React and redux</ h4 >
11+
12+ < div className = 'quantity' >
13+ < a className = 'quantity_minus' title = 'Decrement' > < span > -</ span > </ a >
14+ < input name = 'quantity' type = 'text' className = 'quantity_input' value = "0" />
15+ < a className = 'quantity_plus' title = 'Increment' > < span > +</ span > </ a >
16+ </ div >
17+ </ div >
818 </ >
919 )
1020}
Original file line number Diff line number Diff line change 1+
2+ export const incNumber = ( ) => {
3+ return {
4+ type : "INCREMENT"
5+ }
6+ }
7+
8+ export const decNumber = ( ) => {
9+ return {
10+ type : "DECREMENT"
11+ }
12+ }
Original file line number Diff line number Diff line change 1+
2+
3+ const initialState = 0 ;
4+
5+ const changeTheNumber = ( state = initialState , action ) => {
6+ switch ( action . type ) {
7+ case "INCREMENT" : return state + 1 ;
8+ case "DECREMENT" : return state - 1 ;
9+ default : return state ;
10+ }
11+ }
You can’t perform that action at this time.
0 commit comments