Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
162 views
in Technique[技术] by (71.8m points)

javascript - 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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  • 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...