DEV Community

loading...

Discussion on: Explain Redux like I'm five

Collapse
dezmathio profile image
Josiah Anjos
function handleChange() {
  const currentAppleState = store.getState();
  if (currentApple.color === 'red') {
    console.log('Looks delicious!');
  } else {
    console.log('Looks awful, better throw it in the bin!');
  }
}
store.subscribe(handleChange);

if (currentApple.color === 'red') { should be if currentAppleState.color === 'red') { , right? Loved the explanation though, super straight forward.