Skip to content

Tag: javascript

Why is my component not loading through Vite

I am building a React project with Vite. I was using a tutorial from an article that I found at https://www.digitalocean.com/community/tutorials/how-to-set-up-a-react-project-with-vite. I followed the tutorial as described, however, my “greeting” component will not load. Answer Components should s…

Why is fetch calling api multiple times in react?

I have a very basic api and all it does is return the text “Sunny day”. I create a react project using create react app and try to call the api once then printing result to the console. Here is the react app The problem is the api is getting called twice on page load Can anybody explain why? Answe…