scrimba
React Bootcamp Course
Plain JS Redux Practice 2
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Plain JS Redux Practice 2
AboutCommentsNotes
Plain JS Redux Practice 2
Expand for more info
index.js
run
preview
console
import store from "./redux"
import {changeCount} from "./redux/count"
import {addFavoriteThing, removeFavoriteThing} from "./redux/favoriteThings"
import {setYouTubeTitle, incrementViewCount, upvoteVideo, downvoteVideo} from "./redux/youTubeVideo"

/**
* Challenge:
*
* Create a new state property to hold the currently-logged-in user info. I.e. if our app wanted to allow a user to log in, we would likely want to keep track of some info from the logged in user. For this challenge, you'll save a user with these properties:
* {
* firstName: ___,
* lastName: ___,
* id: ___,
* email: ___
* }
*
* This will require
* (1) Creating a new file to hold our new Redux stuff re: the user (e.g. user.js),
* (2) Creating a new action creator (e.g. "setUserDetails"),
* (3) Creating a new reducer, and
* (4) Adding that reducer to our rootReducer with combineReducers
*/
Console
{count:
42
, favoriteThings:
[]
, youTubeVideo:
{title:
""
, viewCount:
0
, votes:
{up:
0
, down:
0
}
}
}
,
{count:
42
, favoriteThings:
[
"Door bells"
]
, youTubeVideo:
{title:
""
, viewCount:
0
, votes:
{up:
0
, down:
0
}
}
}
,
{count:
42
, favoriteThings:
[
"Door bells"
,
"Sleigh bells"
]
, youTubeVideo:
{title:
""
, viewCount:
0
, votes:
{up:
0
, down:
0
}
}
}
,
{count:
42
, favoriteThings:
[
"Sleigh bells"
]
, youTubeVideo:
{title:
""
, viewCount:
0
, votes:
{up:
0
, down:
0
}
}
}
,
{count:
42
, favoriteThings:
[
"Sleigh bells"
]
, youTubeVideo:
{title:
"Learning Redux is Fun!"
, viewCount:
0
, votes:
{up:
0
, down:
0
}
}
}
,
{count:
42
, favoriteThings:
[
"Sleigh bells"
]
, youTubeVideo:
{title:
"Learning Redux is Fun!"
, viewCount:
1
, votes:
{up:
0
, down:
0
}
}
}
,
{count:
42
, favoriteThings:
[
"Sleigh bells"
]
, youTubeVideo:
{title:
"Learning Redux is Fun!"
, viewCount:
1
, votes:
{up:
1
, down:
0
}
}
}
,
{count:
42
, favoriteThings:
[
"Sleigh bells"
]
, youTubeVideo:
{title:
"Learning Redux is Fun!"
, viewCount:
2
, votes:
{up:
1
, down:
0
}
}
}
,
{count:
42
, favoriteThings:
[
"Sleigh bells"
]
, youTubeVideo:
{title:
"Learning Redux is Fun!"
, viewCount:
2
, votes:
{up:
2
, down:
0
}
}
}
,
{count:
42
, favoriteThings:
[
"Sleigh bells"
]
, youTubeVideo:
{title:
"Learning Redux is Fun!"
, viewCount:
3
, votes:
{up:
2
, down:
0
}
}
}
,
{count:
42
, favoriteThings:
[
"Sleigh bells"
]
, youTubeVideo:
{title:
"Learning Redux is Fun!"
, viewCount:
3
, votes:
{up:
3
, down:
0
}
}
}
,
{count:
42
, favoriteThings:
[
"Sleigh bells"
]
, youTubeVideo:
{title:
"Learning Redux is Fun!"
, viewCount:
3
, votes:
{up:
3
, down:
1
}
}
}
,
/index.html
-8:41