This commit is contained in:
Sacha Weatherstone
2021-06-15 08:41:22 +10:00
parent 59888f32e7
commit 7d220e2683
7 changed files with 199 additions and 265 deletions
+11 -25
View File
@@ -1,36 +1,22 @@
/// <reference types="react/experimental" />
/// <reference types="react-dom/experimental" />
import './index.css';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import Translations_English from './translations/en';
import {
LanguageEnum,
TranslationContext,
} from './translations/TranslationContext';
import { TranslationContext } from './translations/TranslationContext';
const element = document.getElementById('root');
const rootElement = document.getElementById('root');
if (!rootElement) throw new Error('Failed to find the root element');
const root = ReactDOM.createRoot(rootElement);
if (element) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
ReactDOM.createRoot(element).render(
<React.StrictMode>
<TranslationContext.Provider
value={{
language: LanguageEnum.ENGLISH,
translations: Translations_English,
}}
>
<App />
</TranslationContext.Provider>
</React.StrictMode>,
);
}
root.render(
<React.StrictMode>
<TranslationContext>
<App />
</TranslationContext>
</React.StrictMode>,
);
// Hot Module Replacement (HMR) - Remove this snippet to remove HMR.
// Learn more: https://www.snowpack.dev/#hot-module-replacement