How to use the react-imported-component.lazy function in react-imported-component

To help you get started, we’ve selected a few react-imported-component examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github theKashey / react-imported-component / examples / react-hot-loader / src / App.js View on Github external
// @flow
import {hot, setConfig} from 'react-hot-loader'
import * as React from 'react'
import Counter from './Counter'
import imported, {lazy, ComponentLoader, printDrainHydrateMarks} from 'react-imported-component'
import Portal from './Portal'
import Indirect from './indirectUsage';

imported(() => import(/* webpackChunkName: "namedChunk-1" */'./DeferredRender'), {
  async: true
});

const Async = imported(() => import(/* webpackChunkName: "namedChunk-1" */'./DeferredRender'));
const Async2 = lazy(() => {
    console.log('loading lazy');
    return import(/* webpackChunkName: "namedChunk-2" */'./Lazy')
});
const ShouldNotBeImported = imported(() => import(/* webpackChunkName: "namedChunk-2" */'./NotImported'));

const App = () => (
  <h1>
    <p>Component loaded</p>
     import(/* webpackChunkName: "namedChunk-1" */'./DeferredRender')}
    /&gt;
    <p>test!</p>
    <hr>
    <p>C: </p>
    <hr>
    <p>Imported: </p></h1>
github theKashey / react-imported-component / examples / SSR / typescript-react / app / components / Home.tsx View on Github external
import * as React from "react";
import {Helmet} from "react-helmet";
import {Link} from "react-router-dom";
import imported, {lazy, LazyBoundary, remapImports} from "react-imported-component";

const LZ = lazy(() =&gt; import("./LazyTarget"));

const ND = imported(
  () =&gt; remapImports(
    import('./NotDefault'),
    ({NotDefault}) =&gt; NotDefault
  )
);

const Home = () =&gt; (
  <div>
    
      <title>Homepage!</title>
    
    Link to Another
    <div>Hello!</div>
    </div>