I have a react function which is supposed to be my header. This header shall change its background color after reaching a button on scroll. To do so I use a scroll event listener and track its position in relation to the button. This works fine for setTransparent(false), but not for setTransparent(true): Logg…
Tag: reactjs
React updating only first element of list on triggering onChange
I am trying to build a flexible list with an input field so that whenever I write something in that input field it changes the value. Like this: But, in whichever input field I type it changes the only name of first field alone. Like there are 3 input field and 3 paragraph tag according to state. I want to
Firebase Realtime Database, only send data if the key && date don’t exists
I have done a lot of research and read through multiple stackoverflow questionso on firebase. Some were kind of helpful. But none that particularly helped my problem. I am trying to make a menu planner. There for I need more than one check to test if for example. Date exists, serviceType is === to “lunc…
react native: Android back button does not go back on the first click when I am inside the TopTabNavigator
The Android back button does not go back on the first click when I am inside the TopTabNavigator. What actually happens is that the tab goes left and right and only after a few presses of the Android back button only then it go back. How can such a thing be prevented and fix ? in my example i have
Test clearing of search input field on submit (after fetching)
I want to test that a search box does calls a handler (passed as prop) with the fetched results and resets the input field afterwards. This is the error: Answer waitFor returns a Promise so you need to use await:
React hooks callback ref pattern
I often face this situation with react callbacks: The problem is. I consider my component should only load one time. And with useEffect, i have to set onLoad in the dependencies, this cause any change to the onLoad prop to trigger the effect. I generally solve this issue with a ref It works well and solve a l…
req.query is empty and req.url is not complete using react router and express
When the page URL is http://localhost:3000/verify?token=something and I make a GET request using fetch, when I hit the server, req.url is “/verify” instead of “verify?token=something”, also the req.query object is empty The client is running on port 3000 and the server on port 5000. I&…
slickGoTo doesn’t change active slide
I added slider using react-slick to my React app. For <Slider> I added ref, and I’m trying use it to change active slide: but I got an error: TypeError: sliderRef.slick is not a function Why doesn’t this work for me? “react”: “^16.6.3”, “react-slick”: R…
Im getting an error in my react and rest api app where one of my variables is coming back undefined
thank you for your time if youre reading this, im making a full stack app with react and rest api and im encountering an error as such: the part where this error is throwing is right here: heres my createUser function code: heres the code handiling post / users Im really not sure whats going on with my errors…
Regex for String in React
How shall we write a regular expression to validate a string that should have a length of a minimum of 1 character and a maximum of 50 characters, have both upper case and lower case, alphanumeric, include space, and have mostly used special characters like @,._-&$#? The first character should be either a…