nav1/src/index.tsx

26 lines
604 B
TypeScript
Raw Normal View History

2024-10-22 19:30:12 +03:00
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable react/display-name */
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './app';
export default () => <App/>;
let rootElement: ReactDOM.Root
export const mount = (Сomponent, element = document.getElementById('app')) => {
rootElement = ReactDOM.createRoot(element);
rootElement.render(<Сomponent/>);
if(module.hot) {
module.hot.accept('./app', ()=> {
rootElement.render(<Сomponent/>);
})
}
};
export const unmount = () => {
rootElement.unmount();
};