Project

General

Profile

Download (535 Bytes) Statistics
| Branch: | Tag: | Revision:
import ReactDOM from 'react-dom';
import store from '../redux';
import componentRegistry from '../components/componentRegistry';

export function mount(component, selector, data) {
const reactNode = document.querySelector(selector);

if (reactNode) {
ReactDOM.unmountComponentAtNode(reactNode);
ReactDOM.render(componentRegistry.markup(component, data, store), reactNode);
} else {
// eslint-disable-next-line no-console
console.log(`Cannot find \'${selector}\' element for mounting the \'${component}\'`);
}
}
(1-1/7)