Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

267
Views
Render React Component stored in a state containing array of objects

When I apply the filters on the table I want to change the Icon color of the filter Icon, but the icon color is not changing somehow.

enter image description here

This is my component,

const Table = () => {

    const [tableFilters, setTableFilters = useState({name: []})


    let tableColumns = [
        {
            title: 'Name',
            dataIndex: 'name',
            key: 'name',
            filters: [],
            filterDropdownVisible: false,
            filterIcon: (filtered: boolean) => {
                return (
                    <TableFilterIcon filterColumnData={filters.name.data} />
                )
            },
        },
    ]

    const [columns, setColumns] = useState(tableColumns)


    return (
        <>
            <CommonTable
                data={data}
                columns={tableColumns}
            />
        </>
    )
}

export default Table

In TableFilterIcon component I am rendering non-colored and colored icon based on the selected filters, if filters are applied then I am showing color icon. But the TableFilterIcon component is not rendering when I apply the filters that's why Icon color is not changing. Maybe the TableFilterIcon component is in the object of columns that's why ??

Note: if I don't store the columns in state and directly pass the columns to the CommonTable component then it works.

Can anyone help me with this ?? Also, I am using Ant Design Framework for UI components.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!