1.0.2 • Published 5 years ago

rax-use-import v1.0.2

Weekly downloads
3
License
BSD-3-Clause
Repository
github
Last release
5 years ago

rax-use-import

Rax hook for making dynamic import component.

Install

$ npm install rax-use-import --save

Example

import { createElement } from 'rax';
import useImport from 'rax-use-import';

export default function App() {
  const [Bar, error] = useImport(() => import(/* webpackChunkName: "bar" */ './Bar'));
  if (error) {
    return <p>error</p>;
  } else if (Bar) {
    return <Bar />
  } else {
    return <p>loading</p>;
  }
}
1.0.2

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago