javascript library render components code example
Example 1: use javascript library in react
class MainView extends Component {
render() {
return <div/>;
},
componentDidMount() {
const node = ReactDOM.findDOMNode(this);
$(node).activateMyCoolWidget();
ReactDOM.render(<div>{this.props.children}</div>, node);
}
});
Example 2: react.js
class ShoppingList extends React.Component {
render() {
return (
<div className="shopping-list">
<h1>Shopping List for {this.props.name}</h1>
<ul>
<li>Instagram</li>
<li>WhatsApp</li>
<li>Oculus</li>
</ul>
</div>
);
}
}