nadbm / react-datasheet

Excel-like data grid (table) component for React
https://nadbm.github.io/react-datasheet/
MIT License
5.39k stars 457 forks source link

[Question]can react-datasheet work with Redux? #279

Open wangchen-ca opened 3 years ago

wangchen-ca commented 3 years ago

I start on boarding an existing application and learn react and Redux. I have a application using Redux and it uses axios to retrieve remote service url. The return dispatch a action to update state to call the parent component's render to show a data sheet to make user input form. The sheet data is a promise or not available when the render firstly called. I see the log, first time the render called, data in is a empty object, on following calls, real data comes.

I see your examples that data are given as property of component in react render function. Redux enables react app to update state by using action, and render being automatically called to refresh display.

My question, can react-datasheet working with Redux? or if underline data in state changes, what to do to let the sheet to refresh display with new data?

Any advice on my case?

Thanks, Chen

mungojam commented 3 years ago

We're happily using it with redux. We the react-redux useSelector hook and then just set the data props on the table from that and it will update automatically since it is 'declarative' not 'imperative'