I am writing a custom component which integrated a third-party javascript library into Dash Python. This library has a canvasToDOM function which accepts an object with x and y number values and returns same object but with converted values. My goal is to make is possible for the server-side code to pass these coordinates into my component via a callback and then have another callback which will read the converted coordinates.
While I can easily pass input values into my custom component through a property and call the library’s conversion function in React’s componentDidUpdate function, so far I’ve been unsuccessful at returning the conversion results back to the server (either in the same property or in a separate one)
Can you provide a small snippet of your React component in the place where you invoke canvasToDOM and intend to update the converted coordinates (maybe componentDidUpdate is enough)?
You are probably aware of that by now, but all Dash components (in React) get a setProps prop that is used on the React side to update props.
I did manage to solve this by using the setProps prop, although I had to pass it an object, not two individual variables.
It would be great if setProps were better documented on Dash docs page.