When I toggle darkmode it doesn’t update in _app unless I have 2 tabs opened and trigger it in one tab, then the other tab gets updated and darkmode is toggled, but not the tab I pressed the toggle. I use useSettings in both index and _app. I recorded a video so it’s easier to see what’s goi…
Tag: reactjs
Getting error while creating code for my netflix-clone
Row.js component code where i am calling the api key Row.js axios.js Error in the console log is below one, I got the API key from TMBD Api and it was working fine with postman but here in react it is not working properly. Answer you created an axios instance but you did not use it and in the fetchData
Change component state – REACT
I’m currently working on a project with the Pokemon API and i’m facing a problem. I want to change the value parameter in the async function getPokemonTypes(), but the value I receive in handleSelect() is not working. On the console.log(value), the value changes every time I select a different opt…
How to rematch the first word or ‘(‘ the first word at the beginning
str = “find().nodes() as n3” ==> find str = “with n1,n2,n3” ===> with Answer Use string match with the regex pattern ^w+:
How to count the no of occurences of a certain key in an array of object & append the count to each key’s value
How to count the no of occurences of the ‘value’ key in a object inside an array & append the count to each value if any. Here ‘a’ is the source data What i want to achieve is as following Answer
How to pass in multiple action creators to single listenerMiddleware in Redux Toolkit?
I want to save state into my database whenever any of its properties changes. I currently have two middlewares that would dispatch my saveTrip function. The two middlewares are identical but listen to different actionCreators. Store.js: Savetrip function: I am not even using the payload thats passed in when I…
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…
How can I edit the URL without changing pages?
I want to edit the URL of the page without changing to another. Something like this: Same Host, different URL, same page. I think in react-router-dom there is a function, but I don’t remember what the function is called and I looked for it but I didn’t find it Answer Try out !
React.Js and Typescript how to read data from JSON?
everyone. I am using MongoDB with mongoose and React.Js. I have a page where the user can display a post. I am sending fetch request to the backend where I am getting this json data as response. And on the frontend I am using Fetch API, to get this data, what I am trying to do is I want to