How to use the react-imported-component.rehydrateMarks 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 / SSR / parcel-react-ssr / app / client.js View on Github external
setTimeout(function () {
// rehydrate the bundle marks
  console.log('loading');
  rehydrateMarks().then(() => {
    console.log('loaded...');
    setTimeout(function () {
      console.log('rendering');
      // In production, we want to hydrate instead of render
      // because of the server-rendering
      if (1 || process.env.NODE_ENV === 'production') {
        ReactDOM.hydrate(app, element);
      } else {
        ReactDOM.render(app, element);
      }
    }, TM);
  });
}, TM);
github patrickleet / streaming-ssr-react-styled-components / app / client.js View on Github external
export const start = ({ isProduction, document, module, hydrate }) => {
  const element = document.getElementById('app')
  const app = (
    
      
        
      
    
  )

  // In production, we want to hydrate instead of render
  // because of the server-rendering
  if (isProduction) {
    // rehydrate the bundle marks from imported-components,
    // then rehydrate the react app
    rehydrateMarks().then(hydrate(app, element))
  } else {
    ReactDOM.render(app, element)
  }

  // Enable Hot Module Reloading
  if (module.hot) {
    module.hot.accept()
  }
}
github theKashey / react-imported-component / examples / SSR / typescript-react / app / client.tsx View on Github external
const preloadedState = window.__PRELOADED_STATE__;
delete window.__PRELOADED_STATE__;

const store = configureStore(preloadedState);

const element = document.getElementById("app");

const app = (
  
    
      
    
  
);

  rehydrateMarks().then(() => {
    console.log(element.innerHTML);
    ReactDOM.hydrate(app, element);
    console.log(element.innerHTML);
  });