Skip to content

Conversation

@Kanezoor
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’m requesting changes because the Increase button’s logic doesn’t meet the required sequence and will produce incorrect behavior. In src/App.jsx, the handler checks count % 5 === 0 before calling addOne() and calls add100() first; this uses the pre-update value and violates the requirement that Increase must first add 1, then—based on the new value—optionally add 100. This is a critical blocker tied to the checklist requirement and will likely fail tests.

What to fix:

  • Update the Increase logic to base the divisibility check on the incremented value. For example, use a single functional update: setCount(prev => { const next = prev + 1; return next % 5 === 0 ? next + 100 : next; });

What you did well:

  • addOne and add100 correctly use functional updates, and the UI structure matches the requirements.

Minor suggestion:

  • Add a brief comment near the Increase handler explaining the required order to avoid future regressions. Keep going—you’re close; fixing this ordering will align the behavior with the spec.

✨ 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 violates the checklist item: "The 'Increase' button must:

  • Call addOne to increase the count by 1.
  • After adding 1, if the resulting count is divisible by 5, additionally call add100 to increase the count by 100 more."

Currently the component checks count % 5 === 0 (the pre-update value) and calls add100() before calling addOne(). That means the divisibility check is performed on stale state and the required "call addOne first, then possibly add100" behavior is not satisfied. Consider computing the next value in a single functional update (so you base the decision on the new value) or refactoring addOne/add100 so increase can reliably act after the increment. Example (functional update):

setCount(prev => {
  const next = prev + 1;
  return next % 5 === 0 ? next + 100 : next;
});

This avoids stale-state issues and enforces the correct ordering/sequence described in the requirements.

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 Increase handler does not follow the required sequence and will produce incorrect results. In src/App.jsx, the functional update currently checks divisibility using the pre-increment value (prev % 5), which violates the requirement: the button must add 1 first and only then, if the new value is divisible by 5, add 100. This is a critical blocker since it breaks the specified behavior and will cause tests to fail.

  • Critical issue to fix (src/App.jsx, in the increase handler): compute the next value first and base the check on it. For example: compute const next = prev + 1; and return next % 5 === 0 ? next + 100 : next from the functional updater.

  • Minor improvement: add a short comment above increase explaining the intended order (increment, then divisibility check) to prevent regressions.

Your addOne and add100 handlers are correctly implemented with functional updates, and the UI meets the rendering requirements—nice work there. Once you adjust the increase logic as described, this should align with the task requirements.


✨ 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

Comment on lines 17 to 21
setCount(prev => {
const next = prev;

addOne();
return next % 5 === 0 ? next + 101 : next + 1;
});

Choose a reason for hiding this comment

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

This violates the requirement: "Increase button calls addOne and then, if count is divisible by 5, it additionally calls add100." Change the update to compute const next = prev + 1; and then return next % 5 === 0 ? next + 100 : next; so the divisibility check uses the incremented value.

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 approving this submission to support your progress as an educational override. You’ve done a solid job fixing the Increase handler so it computes next = prev + 1 and then checks divisibility, and both addOne and add100 correctly use functional updates with buttons wired properly. However, there’s one requirement mismatch: on src/App.jsx line where you initialize state, const [count, setCount] = useState(0) causes the Increase sequence to start at 1, not the required 101, 102, 103, 104, 105, 206, …. To align with the spec, initialize to 100 so the first Increase yields 101 (hint: useState(100)). Minor improvement: consider adding a brief comment above the Increase handler to clarify the “add 1, then if divisible by 5 add 100” logic for future readers. Nice progress—just adjust the initial state and you’ll fully match the sequence requirement.


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

Footnotes

  1. Rate AI review 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 violates the requirement: "So the third button should count like this: 101, 102, 103, 104, 105, 206, 207, 208, 209, 210, 311 ..." from the task description. The component currently sets count to 0. To match the required Increase sequence, initialize the state so the first Increase yields 101 (for example: const [count, setCount] = useState(100);).

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.

2 participants