Create a table from JSON completely dynamically

前端 未结 2 588
囚心锁ツ
囚心锁ツ 2021-01-28 17:41

I want to create entire table from a JSON array include dynamic ths, so a decoupled the head part to:

import React from \'react\';
import TableDataT         


        
2条回答
  •  耶瑟儿~
    2021-01-28 18:22

    There is a typo again in your .. part, missing {} for your expression. For the dynamic solution after first map you need to map your Objects as well.

    
        
            {
                Object.keys(currElement).map(key => currElement[key])
            }
        
    
    

提交回复
热议问题