Matching Memory

hello everyone, I cannot figure out what is wrong with my code. I have backtracked my steps and found that somewhere around step 9-10 my code does not show any output. There were no error codes so I went on to finish the rest of the project. I think I have some sort of syntax error but nothing is showing up.

Doing a quick scan of your gist I notice that you have

import { useSelector,useDispach } from ‘react-redux’

which has a syntax error it should be useDispatch

I have also just completed step 10 and created a Gist if you want to compare to see what is different as well

Did this actually solve the problem for you? I am also at step 10 and nothing is rendering. I compared with the code above and found one mistake, which I corrected, but still nothing.

Hi, I’ve been able to complete the project up to line 21. But when I add the line of code

const cardsMatched = useSelector(selectMatchedIDs())

to Score.js, the app crashes with an “Uncaught TypeError: state is undefined” error. Any clues on what might be going on?

Your useSelector call looks weird to me because you’re passing it a function invocation.
The common usage of useSelector would be to import a state, in your case ‘selectMatchedIDs’ – which wouldn’t be a function – like
import { selectMatchedIDs } from '{yourSlice}';
This state would need to be exported from your slice.
Then you’d just pass that state to useSelector();

Yeah, I figured it out a second ago. Thanks! (I was confusing action creators with selectors)