Black Lives Matter. Please consider donating to Black Girls Code today.

Animation surface plot

I’m trying to animate surface plot, but when i try to add button in updatemenus for animation react says me that ‘buttons’ is not defined, someone tried to animate like this? What i’m doing wrong?

              <Plot
                data={[
                  {
                    type: "surface",
                    x: this.state.x,
                    y: this.state.t_arr,
                    z: this.state.frames[0]
                  }
                ]}
                frames={this.state.frames}
                updatemenus={[
                  buttons = [
                    {method: 'animate', args: [[]], label: 'sine'},
                  ]
                ]}
              />

Hi @amvicc, welcome to the forum! Not a JS specialist here, but if I take a look at this example I think the order of { and [ should be inverted when defining updatemenus, ie the code should be something like (not tested)

<Plot
                data={[
                  {
                    type: "surface",
                    x: this.state.x,
                    y: this.state.t_arr,
                    z: this.state.frames[0]
                  }
                ]}
                frames={this.state.frames}
                updatemenus=[{
                  buttons = [
                    {method: 'animate', args: [[]], label: 'sine'},
                  ]
                }]
              />

@Emmanuelle Thanks for answering.
I test your code, and JS gives me syntax error, problem not in this part.
Can i found somewhere example of animation with react-plotly.js? Or it’s only examples for plotly.js?