Skip to content
Advertisement

Reactjs Expressjs – Why isn’t my React.js code using updated code from my Express server, but instead old code, even after I refresh the webpage?

I am developing a React.js-Express.js website, and I had set up some basic code with the help of an online example. I had Express.js send an array to the frontend to display it after parsing. However, when I changed the array just a little – literally changed a string to another string – my frontend did not update.

Express – users.js file

JavaScript

React – About.js file

JavaScript

For some reason, the /about page still displays “samsepi0l” and “D0loresH4ze”. How can I fix this?

Advertisement

Answer

This is likely caused by the infamous cache. Usually just hitting Crtl + F5 will fix this, if that doesn’t work, clear your browser history.

If you’re still running into the same problem, then you didn’t save the file and/or restart the server since the code change.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement