После входа в систему я сохраняю тип пользователя в локальном хранилище. Есть типы пользователей, которые должны видеть последний столбец таблицы реагирования. У меня есть проблемы в реализации этого.
<ReactTable
data={data}
filterable
defaultFilterMethod={(filter, row) =>
String(row[filter.id]) === filter.value}
columns={[
{
Header: "Name",
id: "name",
accessor: "item.name",
filterMethod: (filter, rows) =>
matchSorter(rows, filter.value, { keys: ["name"] }),
filterAll: true
},
{
Header: "Public/Rare",
id: "public_or_rare",
accessor: "item.public_or_rare",
filterMethod: (filter, rows) =>
matchSorter(rows, filter.value, { keys: ["public_or_rare"] }),
filterAll: true
},
{
//I want to show something here if user is local or foreigner
}
]}
defaultPageSize={10}
className="-striped -highlight"
/>
В верхней части страницы я получил тип пользователя, как показано ниже,
let user_type = localStorage.getItem('user_type');
Как отобразить последний столбец, если пользователь относится к типу user?