i have a few cases where i'd like to "react" to some of the Popper data in my parent component (the one that renders <Popper>), but i currently have _no way_ to access this data safely. the only current option is to grab a ref to the Popper and inspect its state.data, but that doesn't feel reliable.
some sort of callback prop that would allow my parent component to receive the new Popper data would be very helpful. I wouldn't store all of it, i'd just look at the parts i need and update my minimal state.
(in particular, i'd like to have access to arrow offsets so i can modify my transform-origin)
@souporserious just thought of a potential alternative: would it make sense to include data in the object given to the children functions, next to restProps?
Isn't a custom modifier enough to read data on each cycle?
well damn that seemed to work pretty well! i don't know what i was worried about with that approach... adding a modifier that calls setState based on data works 馃挴
probably reasonable to close this issue now
const updatePopoverState: Popper.ModifierFn = (data) => {
// ... do computations based on data ...
this.setState({ data, based, updates });
return data;
}
Most helpful comment
well damn that seemed to work pretty well! i don't know what i was worried about with that approach... adding a modifier that calls
setStatebased ondataworks 馃挴probably reasonable to close this issue now