I am building a music player for learning. I need help with state management in Next.js 14 attached component tree.
Question: The play-button.tsx is a client component inside the track-item.tsx server component. I cannot pass the handleClick function to play-button from Page.tsx, which is a server component. How can I achieve this?
When a track is played, I want to add a border to this item and remove the border from the previously playing track. Since the entire list is generated on the server, I'm not sure how to remove borders from other items. Maybe I can achieve this if the app state is accessible in track-item.tsx.
I am new to web development and reading about Zustand. Any suggestions on what store I need? Should I wrap the whole app in some type of context provider?