📜  渲染函数中的计算反应 js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:42.142000             🧑  作者: Mango

代码示例1
class Random extends React.Component {
  render() {
    // First, some logic that must happen
    // before rendering:
    const n = Math.floor(Math.random() * 10 + 1);
    // Next, a return statement
    // using that logic:
    return 

The number is {n}!

; } }