Skip to content
Advertisement

Tag: reactjs

Object does not hook [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 6 months ago. Improve this question

React Using addEventListener(“scroll”, function()) and useState shows no transition

I want to change background color of navigation gradually with transition like this Article.js Article.css When I run these, class name ‘active’ is added to the [div] but its background color is changed quickly from rgb(248, 249, 250) to rgb(255, 255, 255). I think this is because addEventListener changes isScrolling every scroll and rerenders the [div] element and its children.

middleware.js in nextjs doesn’t work at all

(Next v.12.2.3) No matter what I code, pages/middleware.js seems not running at all! I wanna redirect uppercase urls to lowercase urls. what should I do? Answer The documentation says: Create a middleware.ts (or .js) file at the same level as your pages directory So it shouldn’t be inside pages/, but in the same directory as pages/.

Pass array value to getStaticProps in Next js

I’m doing fetch request to get my Youtube playlist. and in doing so i used getStaticProps(), the problem I’m facing is that my playlist depends on my array of objects result. the array of objects structure is in my ./utils/playlists.js file. what i want to achieve is that instead of getting my const MY_PLAYLIST = process.env.YOUTUBE_PLAYLIST_ID; from my .env.local file

react gets stuck after i resize the browser window

I used react-simple-image-slider for image slider on my website, but after i resize the browser window the application gets stucked. The main Aim is to make the react-simple-image-slider responsive. The below is the code. Answer You forgot a dependency list for useLayoutEffect so it’s adding an event listener on every render. Add an empty list for one-time execution:

React component not rendering at all

Here’s the code: I’ve been trying to learn React using this online MOOC. I’m on exercise 2.12* Data for countries, step1 and I’m stuck. My search is running fine but I’m unable to solve the last part of the problem: printing information of a selected country or if only 1 country matches the search string. I tried debugging through console.log

Advertisement