I'm using react-table in my project and I have a table with a column named "User". The cells in this column have a card with a couple of user's information, like:
const columns = useMemo(() => ([
{
Header: 'User',
accessor: 'user'
Cell: ({value}) => (
<div className="user">
<h3 className="user__fullname">{value.firstName} {value.lastName}</h3>
<p className="user__email">{value.email}</p>
</div>
)
},
{
Header: 'Action',
accessor: 'action'
Cell: ({value}) => (
<button onClick={(value.onClick)}>{value.name}</button>
)
},
]), [])
And my user data is:
{
user: {
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
},
action: {
name: 'Edit',
onClick: () => null,
},
}
// rest of the data...
I've already tried a couple of different approaches but I couldn't use global filter to filter by firstName, lastName or email.
When I pass just one of those types of data (like firstName) I can filter by it. But when I pass an object containing firstName, lastName and email, I can't filter.
Any ideas?
import * as React from 'react'