freezus

1.0.3 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i freezus

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

172 kB

Total Files

12

Last publish

Collaborators

  • threepointone