Search code examples
node.jsreactjscookieslocal-storagecreate-react-app

Why does Create-React-App auto-create cookies for my website?


I have created a MERN application using Create-React-App.

When run on localhost, and deployed using Heroku, it says the site (or localhost) uses 2 cookies.

It looks like this:
enter image description here

Because of this, I have to add a accept cookie pop up in my website and create a cookie policy..

I did not write a single code about cookies in my app, but there are two.

From my search CRA does not automatically include code for setting cookies.

How can I remove these two cookies?


Solution

  • Based on your screenshot you've included in your question, you've mistaken local/session storage for cookies.

    Both storage types have nothing to do with cookies. Values stored in these storages are not transmitted back to the server and can therefore not be used to identify your users in any way.

    You do not need a cookie policy for these two storages.

    Just to make sure that you didn't accidentally have any cookies set, you could also have a look into your dev-tools. The kinds of storage should be listed separately there.