React - Create nested components with loops

后端 未结 14 1886
情话喂你
情话喂你 2020-12-30 01:27

I have a little issue with React. I can\'t create a nested component with a for loop. What I want to do is create 9 cells of a table and then create 3 rows with 3 cells for

14条回答
  •  余生分开走
    2020-12-30 02:22

    You are pushing functions to the board array. If you want render them, you have to call those functions like

    {board[0]()}
    

    I prepared an example that covers your problem: http://jsbin.com/hofohiy/edit?js,output

提交回复
热议问题