showing results for - "calculations inside a render function react js"
Veronica
24 Feb 2018
1class Random extends React.Component {
2  render() {
3    // First, some logic that must happen
4    // before rendering:
5    const n = Math.floor(Math.random() * 10 + 1);
6    // Next, a return statement
7    // using that logic:
8    return <h1>The number is {n}!</h1>;
9  }
10}