JavaScript - Python Communication

Hi,

I’m working on a react component and I want to call a python callback using a custom method in my react component. Is there a way to do that please?

I created a callback in python and here is the definition:

@app.callback(
    Output("element", "result"),
    Input("element", "value"),
)
def python_callback(request):
     return 100

In my react component method, I only change the value of the “element” to trigger the callback.
This is just for testing and to understand better how it works

Does anyone know what I’m missing please?

Hello @Ismaayl,

Welcome to the community!

Instead of returning a static 100, you should just return the value, that way you can know if it is working.

Thank you for your answer, I think I found the issue, I’m using dash component and I didn’t add “value” to my react component’s prototype

1 Like