react-liftState-cw

Exercise 1

Create one component with player # and a button. Call it twice in a parent component. In the parent component print out the Player number that pressed the button last.

Challenge

Make the two player game similar to what we've done in the past.

Create one component that will be used twice. The component should have 2 labels with buttons below them. The first label should say Player # and the second should be the score. The button should say “1 pt”.

Click the appropriate button to make each player's score go up. There should only be one component created for both players. In the parent class you should determine who's in the lead.

Note:

You can call a function after setState if you want it to run after the state has been set.

setState({something: something}, ()=>something);