Uncaught TypeError: Plotly.react is not a function

My flask app is able to create and update a graph by calling newPlot. I would instead like to update the plot by calling either update or react. When I replace newPlot with either of these functions I get the following error:

Uncaught TypeError: Plotly.react is not a function
or
Uncaught TypeError: Plotly.update is not a function

Plotly.react claims to have the same signature as Plotly.newPlot, but I’m having difficulty finding documentations on how Plotly.update expects its arguments. Do I need to modify my data?

Python code:

graph = dict(
    data=[go.Scatter(
        x = xData,
        y = yData
    )],
    layout=dict(
        title='Plot title,
        yaxis=dict(
            title="Y Axis"
        ),
        xaxis=dict(
            title="X Axis"
        ),
        datarevision = "2",
    )
)

# Convert the figures to JSON
graphJSON = json.dumps(graph, cls=plotly.utils.PlotlyJSONEncoder)
return graphJSON

Javascript:

  $.post('/updatePlot',
    function(response) {
      var figure = JSON.parse(response);
      Plotly.react("graph-0", figure.data, figure.layout);
    })
  }

What version of plotly.js are you using? If a version older than 1.34.0, you’ll need to upgrade.

I believe I’m using version 2.2.1.

From requirements.txt

plotly==2.2.1

… and on the JavaScript side?

Thank you! I changed my source to https://cdn.plot.ly/plotly-latest.min.js and now the calls do not generate errors.

Plotly.update doesn’t apply any changes though. Do I need to modify my graph object before passing it as a parameter? I don’t think I understand the difference between update and react.