react.dom.development.js:29345 Uncaught Error: createRoot(…): Целевой контейнер не является элементом DOM.

App.js

import React, { Component } from 'react';
import {
  BrowserRouter as Router,
  Route,
} from 'react-router-dom';
import HomePage from './pages/HomePage';
import './App.css';

class App extends Component {
  render() {
    return (
      <Router>
        <div className="App">
          <Route path="/" component={HomePage} exact />
        </div>
      </Router>
    );
  }
}

export default App; 
Вход в полноэкранный режим Выход из полноэкранного режима

index.js
import React from ‘react’;
import ReactDOM from ‘react-dom/client’;

import App from ‘./App’;

ReactDOM.createRoot(, document.getElementById(‘root’));

Home.js

import React from ‘react’;

const HomePage = () => (
<>

Здравствуйте, добро пожаловать в мой блог!

Добро пожаловать в мой блог! Proin congue
ligula id risus posuere, vel eleifend ex egestas. Sed in turpis leo.
Aliquam malesuada in massa tincidunt egestas. Nam consectetur varius turpis,
non porta arcu porttitor non. In tincidunt vulputate nulla quis egestas. Ut
eleifend ut ipsum non fringilla. Praesent imperdiet nulla nec est luctus, at
sodales purus euismod.

Donec vel mauris lectus. Etiam nec lectus urna. Sed sodales ultrices dapibus.
Nam blandit tristique risus, eget accumsan nisl interdum eu. Aenean ac accumsan
nisi. Nunc vel pulvinar diam. Nam eleifend egestas viverra. Donec finibus lectus
sed lorem ultricies, eget ornare leo luctus. Morbi vehicula, nulla eu tempor
interdum, nibh elit congue tellus, ac vulputate urna lorem nec nisi. Morbi id
consequat quam. Vivamus accumsan dui in facilisis aliquet..,

Etiam nec lectus urna. Sed sodales ultrices dapibus.
Nam blandit tristique risus, eget accumsan nisl interdum eu. Aenean ac accumsan
nisi. Nunc vel pulvinar diam. Nam eleifend egestas viverra. Donec finibus lectus
sed lorem ultricies, eget ornare leo luctus. Morbi vehicula, nulla eu tempor
interdum, nibh elit congue tellus, ac vulputate urna lorem nec nisi. Morbi id
consequat quam. Vivamus accumsan dui in facilisis aliquet..,

</>
);

экспортировать домашнюю страницу по умолчанию;

Оцените статью
devanswers.ru
Добавить комментарий