Skip to content

Tag: javascript

webVR resetPose replacement

I have a webVR project that used resetPose to reset the origin of the scene but apparently is now deprecated. I used it to reset the camera, so the user would look at the center of the scene again. I assume this function isn’t too hard to replicate: you either have to rotate the scene or the camera to t…

How to detect page scroll to top in React.js?

I have a UI problem to solve in React. When the user start scroll, will add a background class to the header. When scrolling to the top of the page, header background disappear. I have figure out how to add the background while scrolling and modify the state, but how to detect whenever user scroll to the top …

React onClick function in map function

I try to trigger an onClick event in a map function, and I get this error : TypeError: Cannot read property ‘handleClick’ of undefined How do we trigger an onClick event in a map function ? Here is my code : Answer Use an arrow function as the function given to map instead and this will be what yo…