O'Reilly logo

Learning Web Development with React and Bootstrap by Mehul Bhatt, Harmeet Singh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Component integration

We now understand the component life cycle methods. So now let's integrate our component in React using these methods. Observe the following code:

componentDidMount: function() { // When the component is mount into the DOM $(this.refs.alertMsg).hide(); // Bootstrap's alert events // functionality. Lets hook into one of them: $(this.refs.alertMsg).on('closed.bs.alert', this.handleClose); }, componentWillUnmount: function() { $(this.refs.alertMsg).off('closed.bs.alert', this.handleClose); }, show: function() { $(this.refs.alertMsg).show(); }, close: function() { $(this.refs.alertMsg).alert('close'); }, hide: function() { $(this.refs.alertMsg).hide(); }, render: function() { return ( <div className={(this.props.className) + ' ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required