scrimba
Redux Fundamentals With React
Challenge: Actions
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

Challenge: Actions
AboutCommentsNotes
Challenge: Actions
Expand for more info
store
index.js
run
preview
console
import { createStore } from 'redux'

const solarSystem = {
star: 'sun',
planets: [],
constellationsVisible: {
orion: false,
pegasus: true
}
}

const reducer = (state = solarSystem, action) => {
// 1 - Check if the action type that was passed is called ADD_PLANET
// 2 - Clone our initial state (remember thats using Object.assign())
// 3 - Update the planets property in our clone of the state
return state
}

const store = createStore(reducer)

export default store

Console
index.html
-1:53