Arian Nargesi
Arian Nargesi

Reputation: 561

How to add new row to react-table

I know that this is a very basic question. But I couldn't find the answer by now. In my application, I will fetch some data as an array from my graphql server and directly render it using react-table. now I want to add a new row to this table. How should I do that? Thank you very much for your help

Upvotes: 2

Views: 1067

Answers (1)

c0m1t
c0m1t

Reputation: 1242

  • You should update your data object passed to useTable (refetch data from graphql server, triggering a useEffect which fetches data or ...).
  • If it is not some data coming from server, you can manually add it to data (append).

I think you should always keep the reference to the data object.

Upvotes: 3

Related Questions