library react js code example
Example 1: use javascript library in react
class MainView extends Component {
render() {
// don't render anything
return ;
},
componentDidMount() {
// find the DOM node for this component
const node = ReactDOM.findDOMNode(this);
// widget does stuff
$(node).activateMyCoolWidget();
// start a new React render tree with widget node
ReactDOM.render({this.props.children}
, node);
}
});
Example 2: react.js
class ShoppingList extends React.Component {
render() {
return (
Shopping List for {this.props.name}
- Instagram
- WhatsApp
- Oculus
);
}
}
// Example usage:
Example 3: react documentation
class Board extends React.Component {
renderSquare(i) {
return ; }
}