@syuchan1005/use-shared-transition
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

@syuchan1005/use-shared-transition

React hook for shared element transition

Install

npm install --save @syuchan1005/use-shared-transition

Usage

// index.tsx
const A: FC = () => {
  const ref = useRef();
  const refStyle = useSharedTransition('name', ref);
  return (
    <div ref={ref}>Text</div>
  );
};

const B: FC = () => {
  const ref = useRef();
  const refStyle = useSharedTransition('name', ref);
  return (
    <div ref={ref}>Text</div>
  );
};

const App: React.FC = () => (
  {/* react-router */}
  <BrowserRouter>
    <div>
      <Link to="/">A</Link>
      <Link to="/b">B</Link>
    </div>
    <Switch>
      <Route exact path="/" component={A} />
      <Route exact path="/b" component={B} />
    </Switch>
  </BrowserRouter>
);

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @syuchan1005/use-shared-transition

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

5.66 kB

Total Files

5

Last publish

Collaborators

  • syuchan1005