1.0.3 • Published 6 years ago

freezus v1.0.3

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

freezus

work in progress

ost

yarn add freezus

import Transition from 'freezus'

// ...

<Transition
  id={key} // change this for every transition
  onEnter={async id => ...}
  onExit={async id => {
    // do whatever!
    // the previous render sticks around until this function exits
    // and by magic, redux state is frozen inside it!
    // local state and everything else works as expected

    // you can now manually animate that old element out,
    // do a shared element transition, whatever.
    // use jquery for all I care
    // refs are doubly useful here :)
  }}>
  <SomeContent/>
</Transition>

cancellation

callbacks also receive a function cancelled that tests whether a transition has been cancelled. you can use this to synchronize stuff.

onExit={async (id, cancelled) => {
  await sleep(1000)
  if(!cancelled()){
    // do the thing
  }
  ...
}}

todo -

  • examples
  • tests
  • freeze react-router
  • freeze anything on context
  • <ReactTransition that matches the popular one, good for migrating