如何使用React Redux从嵌套Json创建动态表

时间:2019-07-09 06:50:14

标签: reactjs react-redux

我想根据来自redux页面的嵌套json对象创建动态表

<Table striped bordered hover responsive className="mt-2">
  <thead>
    {/* keys.map(header => <th>{this.state}</th>) */}

    <tr>{/* I need dynaic TR */}</tr>
  </thead>
  <tbody>
    {accounts && accounts.length ? (
      accounts.map((account: any) => (
        <tr
          key={account.get("uuid")}
          style={{ cursor: "pointer" }}
          // onClick={() => this.props.history.push(match.url + '/' + application.get('uuid'), application)}
        >
          {/* <td> {account.get('uuid')} </td>  */}

          <td>{account.get("account_data")}</td>

          <td>
            {account.get("entitlements") && (
              <ul>
                {account
                  .get("entitlements")
                  .split(";")
                  .map((access: any) => (
                    <li>{access}</li>
                  ))}
              </ul>
            )}
          </td>
        </tr>
      ))
    ) : (
      <tr>
        <td colSpan={5} style={{ textAlign: "center" }}>
          No Accounts Found. Please sync and retry.
        </td>
      </tr>
    )}
  </tbody>
</Table>;

打印<td>{account.get('account_data') }</td>后,我正在获取帐户数据。我想在account_data上创建表格。如何根据这些数据制作表格?

这是打印account_data

后的输出

enter image description here

0 个答案:

没有答案