How to use the react-loadable.preloadReady function in react-loadable

To help you get started, we’ve selected a few react-loadable 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 pedrobullo / boilerplate-nutella / src / client / index.js View on Github external
import React from 'react';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
import { hydrate } from 'react-dom';
import Loadable from 'react-loadable';
import { HelmetProvider } from 'react-helmet-async';

import DataLoader from '../common/lib/DataLoader';

import configureStore from '../common/redux/store';

// Initialize store
const store = configureStore(window.__INITIAL_STATE__);
const mountApp = document.getElementById('app');

Loadable.preloadReady().then(() => {
  hydrate(
    
      
        
          
        
      
    ,
    mountApp,
  );
});

// For hot reloading of react components
if (module.hot) {
  console.log('🔁  HMR Reloading - client');
  module.hot.accept();
github Tarnadas / smmdb / src / shared / renderer.tsx View on Github external
: 
          
        
    }
  
  const jsx = isServer
    ?  {
      modules.push(moduleName)
    }}>
      { _jsx }
    
    : _jsx

  if (!isServer) {
    await preloadReady()
  }
  const html = reactRenderer(jsx, !isServer && document.getElementById('root'))
  return [html, store.getState(), modules]
}
github trouble / react-wp-rest / client / src / index.js View on Github external
window.onload = () => {
		Loadable.preloadReady().then(() => {
			ReactDOM.hydrate(
				
					
						
					
				
			, document.getElementById('root'));
		})
	}
} else {
github damassi / isomorphic-relay-app / relay-modern / src / lib / isomorphic-relay / mountClient.js View on Github external
export function mountClient(routes) {
  const { relay } = window.__BOOTSTRAP__
  const routerCache = new Cache()

  routerCache.set(window.location.pathname, relay.response)

  Loadable.preloadReady().then(() => {
    ReactDOM.hydrate(
      
        {renderRoutes(routes, relay)}
      ,
      document.getElementById('react-root')
    )
  })
}
github weishiji / isomorphic-app / client / index.jsx View on Github external
global.main = () => {
  Loadable.preloadReady().then(() => {
    hydrate(, global.document.getElementById('root'), () => {
      const ssStyles = global.document.getElementById('jss-server-side');
      ssStyles.parentNode.removeChild(ssStyles);
    });
    global._ASYNC_FETCH = true;
  });
};
github jamiebuilds / react-loadable / example / client.js View on Github external
window.main = () => {
  Loadable.preloadReady().then(() => {
    ReactDOM.hydrate(, document.getElementById('app'));
  });
};
github glennreyes / razzle-experiments / src / client.js View on Github external
import App from './App';
import React from 'react';
import { hydrate } from 'react-dom';
import Loadable from 'react-loadable';
import BrowserRouter from 'react-router-dom/BrowserRouter';

Loadable.preloadReady().then(() => {
  hydrate(
    
      
    ,
    document.getElementById('root'),
  );
});

if (module.hot) {
  module.hot.accept();
}
github stefanlazarevic / isomorphic-react-boilerplate / src / client / client.js View on Github external
const HMRRenderer = Component => {
  preloadReady().then(() => {
    module.hot
      ? render(Component, documentRoot)
      : hydrate(Component, documentRoot);
  });
};
github JounQin / react-hackernews / src / entry-client.js View on Github external
const render = () => {
  const app = (
    
      
        
      
    
  )

  Loadable.preloadReady().then(() =>
    hydrate(app, document.getElementById('app')),
  )
}
github awinogradov / cra-ssr-boilerplate / src / index.tsx View on Github external
const render = (Component: React.ComponentType) => preloadReady().then(() =>
    ReactDOM.hydrate(
        
            
        ,
        document.getElementById('root')
    )
);