How to use the @ice/stark-app.getMountNode function in @ice/stark-app

To help you get started, we’ve selected a few @ice/stark-app 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 ice-lab / react-materials / scaffolds / ice-stark-child / src / index.jsx View on Github external
import ReactDOM from 'react-dom';
import { isInIcestark, getMountNode, registerAppEnter, registerAppLeave } from '@ice/stark-app';
import './global.scss';
import router from './router';

if (isInIcestark()) {
  const mountNode = getMountNode();

  registerAppEnter(() => {
    ReactDOM.render(router(), mountNode);
  });

  // make sure the unmount event is triggered
  registerAppLeave(() => {
    ReactDOM.unmountComponentAtNode(mountNode);
  });
} else {
  ReactDOM.render(router(), document.getElementById('ice-container'));
}

@ice/stark-app

icestark-app is a JavaScript library for icestark, used by sub-application.

MIT
Latest version published 3 years ago

Package Health Score

62 / 100
Full package analysis

Popular @ice/stark-app functions