Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

your commit message #1193

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

andriy-chornyy
Copy link

No description provided.

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.

It looks like there's a small but critical issue with the useState hook in your App.jsx file. The second element of the array destructuring should be a function to update the state, not the event handler directly. Once you correct this, your component should function properly. Keep up the great work, and don't hesitate to reach out if you need further guidance! 😊

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

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

<div className="section">
<h1 className="title">Selected tab is Tab 1</h1>
export const App = () => {
const [activeTabId, onTabSelected] = useState(tabs[0].id);

Choose a reason for hiding this comment

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

The useState hook is used incorrectly here. The second element of the array destructuring should be a function to update the state, typically named something like setActiveTabId, not the event handler onTabSelected. You should rename onTabSelected to something like setActiveTabId and then use this function to update the state when a tab is selected.

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

Great job on implementing the task requirements! 🎉 Your code meets the specified constraints, and the overall structure is well-organized. Here are some key points and suggestions for improvement:

  • App.jsx:

    • You have correctly used the useState hook to manage the activeTabId state. However, ensure that the second element of the array destructuring is a function to update the state, not the event handler directly. Consider renaming onTabSelected to something like setActiveTabId to better reflect its purpose.
  • Tabs.jsx:

    • The component is well-structured and correctly implements the tab functionality. The use of the classnames library is appropriate for conditional class application. Ensure that the onTabSelected function passed from the parent component is correctly set up to update the state.

Final Conclusion

Your solution meets the task requirements and constraints. All checklist items are satisfied, and the implementation is correct. Although there are some critical issues, such as the use of the useState hook, addressing them will enhance the functionality of your code.

Keep up the good work and continue learning from these experiences! 🚀 Remember to review the comments and improve your code accordingly.

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

</a>
</li>
export const App = () => {
const [activeTabId, onTabSelected] = useState(tabs[0].id);

Choose a reason for hiding this comment

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

The useState hook returns an array with two elements: the current state and a function to update it. Here, onTabSelected should be the function to update the state, not the event handler itself. You should rename onTabSelected to something like setActiveTabId to reflect its purpose and ensure it is used correctly.

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