Open fitz95 opened 1 year ago
Cheers and Happy coding! :clap: :computer: :wine_glass: Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better.
You can also consider:
Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.
_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 React hooks in the functional components of this react application already so I do not need to refactor my code. In my calculator function, every time a button is pressed
onClickHandler
function is called and passes a parameter value, which is a string based on the button functionality `` The respective button values are:the onHandleClick function is attached to a hook that executes the setCalState function https://github.com/fitz95/Math-Magicians/blob/5fcae2260a464dc46ee450066031eb9bb30235f8/src/components/Calculator.js#L11-L13 This function then executes the calculate function provided by Microverse that takes in an Object and a button value parameter
The calculate function returns an object that has three properties which are
Now we display the result on the Ui using a conditional so we display some specific result at a specific time in the calculation flow https://github.com/fitz95/Math-Magicians/blob/5fcae2260a464dc46ee450066031eb9bb30235f8/src/components/Calculator.js#L16-L24