Skip to content

Conversation

@tavorotuk
Copy link

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

I am requesting changes because the current implementation breaks the required Increase sequence and ordering. In src/App.jsx, the initial state count is set to 0 (around line where useState(0) is declared), which causes the first Increase to yield 1 instead of the required 101; initialize to 100 or compute the next value inside increase so the first press results in 101. Additionally, in the increase handler (line where divisibility is checked), you check divisibility and call add100 before performing the +1, but the requirement is to call addOne first and then, based on the updated value, conditionally call add100. A correct pattern is: compute next = prev + 1, update to next, and only if next % 5 === 0 then apply the additional +100 (you can do this in a single setCount(prev => { const after = prev + 1; return after % 5 === 0 ? after + 100 : after; })). The addOne and add100 helpers are good—keep those as-is and wire Increase to use the proper order and check. These changes are critical to meet the core requirement and will otherwise fail the expected sequence/tests. Once fixed, your UI and helper functions should pass the scenario—nice work on the functional updaters and button wiring!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example


export const App = () => {
const [count] = useState(0);
const [count, setCount] = useState(0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This initializes count to 0 which violates the requirement: "Initial count state should align with producing the given sequence when clicking "Increase" repeatedly". To produce the sequence starting with 101 on the first Increase, initialize count appropriately (for example to 100) or compute the next value inside increase so the first Increase yields 101. See task description for the exact sequence requirement.

Copy link

@vitalii-bondarenko-ua vitalii-bondarenko-ua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants