reactjscookieslocal-storage

How to store sensitive data in react js frontend?


I want to clear this issue. I'm new to react js. but I need to store some sensitive data in frontend. just like database name, database password, and database username. I have used universal-cookie and local storage also. but it seems like not secure. because anyone can edit that data if they inspect the page and open the cookie tab. I just want to know if there is a way to make these cookies uneditable or suggest to me if there is a better way to keep this data in frontend?

Thanks in advance

i have edited the access token and dbname for testing


Solution

  • Normally, sensitive data is not saved on the frontend. The best approach is to fetch this data from the server using an HTTP request. Alternatively, you can use local storage, cookies, session storage, etc. Another option is to set up environment variables. Additionally, you can use third-party storage solutions, as many free and trusted resources are available.