✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

How to wrap react components with properties of type Function

I am looking into writing a Dash wrapper layer for the react leaflet GeoJSON component. Some of its properties, e.g. style, are of the type Function. Is there a recommended approach to set such properties from Dash?

I guess the only option is to evaluate the functions in the Python layer prior to the construction of the GeoJSON object. I can then pass the resulting values as a non-functional property, e.g. a dict of <feature_id, function_value>, from which the functions can be created in the javascript layer. Do you agree @chriddyp, @alexcjohnson?

Yeah that’s it exactly. Another guide to check out is our D3 + React + Dash documentation (https://dash.plotly.com/d3-react-components). In these examples, there might be D3 functions, but at the top-level is a declarative description of what you’d like displayed.

2 Likes