Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<div id="root">${ReactDOMServer.renderToString(<App />)}</div> - SyntaxError: Unexpected token '<' #16

Open
guddukmr786 opened this issue Aug 31, 2021 · 0 comments

Comments

@guddukmr786
Copy link

node server/server.js
file:///var/www/Guddu/ssr-example/server/server.js:23
<div id="root">${ReactDOMServer.renderToString(<App />)}</div>
^

SyntaxError: Unexpected token '<'
at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
at async link (internal/modules/esm/module_job.js:42:21)

my package.json -
{
"name": "ssr-example",
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/preset-env": "^7.7.1",
"@babel/preset-react": "^7.7.0",
"@babel/register": "^7.7.0",
"express": "^4.17.1",
"ignore-styles": "^5.0.1",
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-scripts": "3.2.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"ssr": "node server/index.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"type": "module"
}

@guddukmr786 guddukmr786 changed the title <div id="root">${ReactDOMServer.renderToString(<App />)}</div> <div id="root">${ReactDOMServer.renderToString(<App />)}</div> - SyntaxError: Unexpected token '<' Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant