GithubHelp home page GithubHelp logo

ayub-begimkulov / retransition Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 0.0 782 KB

A library that helps you create smooth transitions in your react app.

License: MIT License

HTML 2.43% TypeScript 91.12% JavaScript 4.76% CSS 1.69%
react css-transition transition animation css-animation typescript

retransition's People

Contributors

ayub-begimkulov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

retransition's Issues

`<TransitionGroup />` incorrectly updates children

Привет!

Столкнулся с проблемой обновления списка элементов, обернутого в Transition. Опишу кейс:

  1. Сначала оборачиваем функцию рендера элементов в TransitionGroup

<TransitionGroup name="fade">{list.map(renderItem)}</TransitionGroup>

  1. Затем опишем функцию, которая возвращает элемент обернутый в Transition
const renderItem = (item) => (
   <Transition key={item.id}>
     <li key={item.id}>
       {item.a} - {item.b}
     </li>
   </Transition>
 );

Если list это массив элементов, каждый из которых является объектом, который содержит в себе id и прочие свойства, то при обновлении листа Transition будет либо мешать перерендеру, в случае если не был обновлен id (или свойство, которое было ему передано в качестве key), либо воспроизводить анимацию, даже если порядок элементов не был изменен.

Воспроизвел пример тут => CodeSandbox

React 18.0

Starting from React 18 when I use createRoot to mount my root component, <TransitionGroup /> component flickers at the end for some reason. Not sure why it happens but it isn't difficult to reproduce.

2023-11-26.19.04.54.mov

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.