Lifting up the state

I would highly recommend using CodeSandbox and not Codepen. You will get much better error messages which is a huge help when debugging. Codepen often just swallows the errors and gives little to no indication of what is wrong.

BTW, here is the other thread just for cross reference