Skip to content
Advertisement

Tag: reactjs

React + NodeJs Fetch issue

I am trying to fetch the following results of my api (which is working well) http://localhost:5000/api/continents into a react component (a simple array to begin with). Endpoint code extracted from server.js: Here is my continents.js code: And here is the App.js code: Issue: continents array is empty. No data fetched. However, there are no errors. I would very much appreciate

Make React useEffect hook not run on initial render

According to the docs: componentDidUpdate() is invoked immediately after updating occurs. This method is not called for the initial render. We can use the new useEffect() hook to simulate componentDidUpdate(), but it seems like useEffect() is being ran after every render, even the first time. How do I get it to not run on initial render? As you can see

When should you NOT use React memo?

I’ve been playing around with React 16.6.0 recently and I love the idea of React Memo, but I’ve been unable to find anything regarding scenarios best suited to implement it. The React docs (https://reactjs.org/docs/react-api.html#reactmemo) don’t seem to suggest any implications from just throwing it on all of your functional components. Because it does a shallow comparison to figure out if

Advertisement