Code Monkey home page Code Monkey logo

Comments (4)

chriddyp avatar chriddyp commented on May 23, 2024 2

There are two concepts that are in Beta for doing this: Events and State. I haven't documented them yet because I'm not confident yet that Events is the correct abstraction. For now, you can see an example here on how they work: https://gist.github.com/chriddyp/e546a2a2c05df29c868e4cef57fb2105, but just know that this may change in the future.

In the short term, I'm planning on adding "click stateto every component, an attribute that is something liken_clicks`. Then, you could subscribe to that change with something like:

@dash.dependencies(Output(...), [Input('my-button', n_clicks')])
def update_on_click(number_of_times_the_button_has_been_clicked):
    return ...

If you knew the number of times the button has been clicked, you could even do something like toggle things on and off depending on whether n_clicks was even or odd.

from dash.

chriddyp avatar chriddyp commented on May 23, 2024 1

now documented in https://plot.ly/dash/state

from dash.

tomron avatar tomron commented on May 23, 2024

The example does not work - there is an error in line 52 -

NameError: global name 'go' is not defined

from dash.

Ricardo-C-Oliveira avatar Ricardo-C-Oliveira commented on May 23, 2024

The idea of being able to access the state of a giving component aligns pretty well with how React handles things like this. Or maybe, there could be a "redux store" could be accessed at any point by any function.

from dash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.