Answer the question
In order to leave comments, you need to log in
How to call a component on event'y in react?
There is a Notification component that outputs something like:
render() {
return (<div>{this.props.text}</div>);
}
select={(id) => (action) => {
console.log('bla');
{<Notification text="test" />}
}}
Answer the question
In order to leave comments, you need to log in
In the state of your application, you have a "notification" field. Display the Notification component when this field is filled in the model. Filling in the field causes the components to be redrawn and the Notification is displayed. On a timer, clear this field so that the notification disappears.
Just keep in mind that react is just a library for rendering components. How to store the state of your application, how to notify react about state changes is a separate topic, in react it is customary to use the flux pattern for this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question