We have some use cases where we need to interrogate the grid for its internal state. At the moment we are using a solution that looks like this:
import { createSnapshotHook, createHook } from 'grid-hook-component'
const hook = createHook(callback)
function callback(rows, columns) {
// some side effect
}
myGrid.use( createSnapshotHook().hook(hook) )
Then further down in our application we can request a snapshot at any time, and it will be handled by the hook's callback:
In #7 we discussed this might make more sense to do at the grid level. Is that the case? I think it might be a good idea to implement it as a component. I can see at least 2 use cases for a hook component:
- You can define many different hooks and pass them to the grid to query the state at different times
- You can define a single hook and process in many different ways (ala middleware) by several consumer.
Thoughts?
We have some use cases where we need to interrogate the grid for its internal state. At the moment we are using a solution that looks like this:
Then further down in our application we can request a snapshot at any time, and it will be handled by the hook's callback:
In #7 we discussed this might make more sense to do at the grid level. Is that the case? I think it might be a good idea to implement it as a component. I can see at least 2 use cases for a hook component:
Thoughts?