You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{useState}from'react';import{MovingBlock}from"./components/moving-block";import{VerySlowComponent}from'./components/very-slow-component';import{BunchOfStuff,OtherStuffAlsoComplicated}from'./components/mocks';exportdefaultfunctionApp(){return(<ScollableContentWithMovingBlock><VerySlowComponent/><BunchOfStuff/><OtherStuffAlsoComplicated/></ScollableContentWithMovingBlock>);}functionScollableContentWithMovingBlock({ children }){const[position,setPosition]=useState(150);constonScroll=(e)=>{constcalculated=getPosition(e.target.scrollTop);setPosition(calculated);};return(<divclassName="scrollable-block"onScroll={onScroll}><MovingBlockposition={position}/>{children}</div>);}// just hard-coded approximation to demonstrate the re-renders problem// not to be used in real codeconstgetPosition=(val)=>150-val/2;
The text was updated successfully, but these errors were encountered:
App.jsx
The text was updated successfully, but these errors were encountered: