I am very new to React and I want to render another react component on a single click. I have a component ListModules which has a button in it, now when I click the button another component should get rendered. I have written the below code, module is my state and has value from the backend.
const addTimeline = () => {
return <ColorsTimeline data={module} />
}
<button type="submit" class="btn btn-success" onClick={addTimeline}>DONE</button>
Please help :)