Error 'Unexpected token u in JSON at position 0' when using


I get this error when I use the store component.

It only shows in the beginning of a page load / refresh.

Anyone know why causes this and how to fix it?

There’s probably a few ways to get this error, but one thing to try is to make sure you have the dcc.Store component included in the initial layout. If you have a multi-page app, you’ll need to initialize the app like this:

app.layout = html.Div([
    dcc.Location(id='url', refresh=False),
    dcc.Store(id='my-store', storage_type='session')