I’ve done the calculator part but I don’t know how to constantly update the <h2>{value}</h2> so that the value in Screen is always up-to-date with this.state.value
Okay. First off; you can’t just directly import on Codepen. It doesn’t mesh well with Babel JSX processing and will cause things not to render on screen.
As for the Screen component, it never gets an update. It’s rendered once and completely forgotten. Secondly please don’t ever just pass your entire state to another component and never ever name it state. It’ll break things. For this exercise, it’s best to keep the screen component’s elements inside the App component.
But if I was going to pass down those values I’d do something like in the constructor:
That’s literally the purpose of props; to hold all your data for a new component.
The only time I think a sub-component being used to render something is a good idea is if it doesn’t change or provides a special feature I can’t achieve normally.
You do not have a single setState anywhere in your code.
You can’t just mutate the state, that isn’t how React works. It won’t know something has changed which means it doesn’t know to re-render if you do not update the state properly.
If you want to use class-based components you can revisit the React curriculum or find some old tutorials.
But if you have to learn React I would suggest you forget about class components and use functions/hooks. The new React docs are pretty good and most tutorials will teach functions and hooks.