project_travel_advisor
project_travel_advisor copied to clipboard
Scroll Into View
Hey, there Adrian! Don't know why is this happening
ScrollIntoView is not working
I`ve re-write the code couple of times by going back into the video where you start explaining CHILD CLICKED
CHILD CLICKED IS WORKING as shown in console.log
but after that when you explain if(selected) refProp?.current?.scrollIntoView({ behavior:'smooth', block:'start' })
everything runs except child click stops and the scroll does not work when clicked
Replace your code to this where you're rendering your PlaceDetails component
<Grid ref={elRefs[i]} key={i} item xs={12}> <PlaceDetails selected={Number(childClicked) === i} refProp={elRefs[i]} place={place} /> </Grid>
In the video, he deleted ref={elRefs[i]}
but is required.
Guys i have done everything asked here and still my scroll doesnt work similar to @Shubham-Sakhare any help is appreciated.
Guys i have done everything asked here and still my scroll doesnt work similar to @Shubham-Sakhare any help is appreciated.
did you try using the apporach above?
Thanks @gr8guyrabi , that worked like a charm.
Replace your code to this where you're rendering your PlaceDetails component
<Grid ref={elRefs[i]} key={i} item xs={12}> <PlaceDetails selected={Number(childClicked) === i} refProp={elRefs[i]} place={place} /> </Grid>
In the video, he deleted
ref={elRefs[i]}
but is required.
Thanks Bro! works like a charm.
Replace your code to this where you're rendering your PlaceDetails component
<Grid ref={elRefs[i]} key={i} item xs={12}> <PlaceDetails selected={Number(childClicked) === i} refProp={elRefs[i]} place={place} /> </Grid>
In the video, he deleted
ref={elRefs[i]}
but is required.
Excelent! it works!!!!!
Replace your code to this where you're rendering your PlaceDetails component
<Grid ref={elRefs[i]} key={i} item xs={12}> <PlaceDetails selected={Number(childClicked) === i} refProp={elRefs[i]} place={place} /> </Grid>
In the video, he deleted
ref={elRefs[i]}
but is required.
It is working but not creating similar effect like that in video.
Thanks @gr8guyrabi . Lobe you💋