1👍
✅
It looks like chartjs-plugin-dragdata
registers events on inialization and doesn’t update them later. You’d need to use useRef
to get the current value.
const { activeState } = useContext(CertainContext);
const ref = useRef('');
ref.current = activeState;
...
const options = {
// other options
plugins: {
dragData: {
onDragStart: () => {
console.log(ref.current);
},
}
}
}
Source:stackexchange.com