Smoothly transitioning to new layout?

Smoothly transitioning to new layout?



I'm building a lot of UI in react where various elements may appear/disappear. I'm trying to figure out a generic way to smoothly animate to new layouts when an elemnt is added or deleted, like:


var jsxA = <div><div>one</div>
<div>two</div>
<div>three</div></div>

var jsxB = <div><div>one</div><div>three</div></div>



When going from jsxA to jsxB I don't want a snap as three moves up to where two was.



I've looked at doing things with mapping, I think having keys so that react knows an element is still the same one as before helps but not sure how to make it know to animate to the new position.





Are you looking for .scrollTo()?
– Obsidian Age
Aug 23 at 4:14


.scrollTo()









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Malaysia to Papua New Guinea by motorcycle?

List of Bhojpuri films

PHP code is not being executed, instead code shows on the page