Answer the question
In order to leave comments, you need to log in
Error when SSR React app?
Good day) such an interesting problem arose. I'm rewriting a React app with SSR rendering, and on page load it throws an error: "Uncaught SyntaxError: Unexpected token '<'" . At the same time, it renders the text of the Header component, but without styles. Without SSR everything works ok.
Connected Babel on the server: at the entry point, I first call @babel/polyfill and @babel/register with @babel/preset-env and @babel/preset-react plugins. Then I call the file in which the server logic is written.
In the server file, I simply replace the contents of div#root with the string received via ReactDOMServer.renderToString.
Answer the question
In order to leave comments, you need to log in
Type error. You need to look at the code. Somewhere something like this happened:
function func(string) { return string }
func( {title: 'Hello' } );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question