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

Hi,

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),
    html.Div(id='page-content'),
    dcc.Store(id='my-store', storage_type='session')
])