Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
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()
}
}
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);
});