Когда я делаю это в index.js, это работает:
Код: Выделить всё
const Home = () => {
return (
);
};
export default Home;
Код: Выделить всё
import HomePage from './HomePage';
import React from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
const Home = () => {
return (
);
};
export default Home;
Код: Выделить всё
Server Error
ReferenceError: document is not defined
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Код: Выделить всё
const Home = () => {
if (typeof document !== 'undefined') {
return (
);
} else {
// Handle server-side rendering (optional)
return null;
}
};
Код: Выделить всё
Unhandled Runtime Error
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Check the render method of `Home`.
Подробнее здесь: https://stackoverflow.com/questions/780 ... ional-page
Мобильная версия