Next.js Discord

Discord Forum

Replacing components with button click

Answered
Pollock posted this in #help-forum
Open in Discord
PollockOP
How does one replace components on button click for example?
ReplaceWith doesnt work on custom react components, only standard html elements...
Answered by LuisLl
Just render the other component in place of the previous one when you perform certain event.

Control it with React state.
View full answer

5 Replies

Just render the other component in place of the previous one when you perform certain event.

Control it with React state.
Answer
@Pollock any updates?
PollockOP
Ye i did conditinal render with usestate
Can close this
Got other problem now lmao