[v6] Externalize columns data array #2287
-
I'm trying to create a generic "one-table-to-display-all" view based on a data provided from the parent component to the component where react-table is used. First piece which I was looking to externalize was I had it set in the main code for the component where react-table was used as
which was working fine but when I have moved that part as a child component and then tried to import it to the parent component with the react-table as
bu it was complaining about missing states like My question is if this approach is possible if so what I have missed? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I have solved that problem as I was not able to find perfect solution but workaround mentioned below was good enough for me to achieve what I was looking for. I have created common table headers index file which contains all locations for table headers: tableHeaders.jsx
and then in the view for the main component specify prop for that:
and in the MyTable.jsx:
Hope it will helps someone else or somebody else will came up with better solution. |
Beta Was this translation helpful? Give feedback.
I have solved that problem as
I was not able to find perfect solution but workaround mentioned below was good enough for me to achieve what I was looking for.
I have created common table headers index file which contains all locations for table headers:
tableHeaders.jsx
and then in the view for the main component specify prop for that: