在反应表钩子中使用反引号

时间:2021-02-22 02:33:06

标签: reactjs react-table react-table-v7

大家好,我在 backticks 的 hooks 部分使用 useTable 时遇到问题

例如,在下面的代码中,我声明 randomVarBT 会给我一个错误。

    (hooks) => {
      hooks.visibleColumns.push((columns) => [
        ...columns,
        {
          id: 'view',
          groupByBoundary: true,
          Header: () => (
            <div>
              View
            </div>
          ),
          Cell: ({ row }) => {
            const randomVarBT = `x`;
            return (
              <Button myval={randomVarBT} />
            );
          },
        },
      ]);
    },

我收到以下错误。如果我使用 "" 而不是反引号,则不会出现以下错误。

<块引用>

无法读取 null 的属性“值” 在 linting /home/LOCATION_TO_FILE/Filename.js:87

时发生

0 个答案:

没有答案