Open Nkaleth opened 1 year ago
Your project is complete! There is nothing else to say other than... it's time to merge it :shipit:
Cheers and Happy coding!👏👏👏
Feel free to leave any questions or comments in the PR thread if something is not 100% clear. Please, remember to tag @CollinsTatang in your question so I can receive the notification.
As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.
I used the
useState
hook in this line to add a state variable toCalculator
component, the initial state is{}
:https://github.com/Nkaleth/Math-magicians/blob/095dbaaae5b53d974180a0a0efda88fa5fe57d1b/src/components/Calculator.js#L7
Then I update the state in this line with the calculate function with the current state and the string of the clicked button:
https://github.com/Nkaleth/Math-magicians/blob/095dbaaae5b53d974180a0a0efda88fa5fe57d1b/src/components/Calculator.js#L10
Finally, when the state has been changed, react detecs it and start a re-render of the calculator component, specifically this
<p></p
tag which its inner text depends on the new state.https://github.com/Nkaleth/Math-magicians/blob/095dbaaae5b53d974180a0a0efda88fa5fe57d1b/src/components/Calculator.js#L15