Add support for React Hooks
See original GitHub issueHow can I use this awesome lib with react hooks?
I’m stuck with onFieldChange
:
function onFieldChange(rowId, field, value) {
// Find a row that is being changed
const row = rows.find((id) => id === rowId);
// Change a value of a field
row[field] = value;
setRows([].concat(rows));
// Blurring focus from the current cell is necessary for a correct behavior of the Grid.
setBlur(true);
return null;
}
<Input
value={make_date_string(row.date)}
onChange={onFieldChange(row.id, "date")}
focus={focus}
/>
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Introducing Hooks - React
React 16.8.0 is the first release to support Hooks. When upgrading, don't forget to update all packages, including React DOM. React Native has...
Read more >Hooks at a Glance - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. Hooks are...
Read more >Building Your Own Hooks - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. Building your...
Read more >Hooks FAQ - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. This page...
Read more >Hooks API Reference - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. This page...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @avalanche1 Absolutely agree. Now the library is fully compatible with React hooks. All the examples in the Readme were rewritten with hooks, so you can check them.
That project was eventually abandoned, so cannot comment on the specific problem now. But react hooks version would still be very welcome, since it’s standard React api now.