2

I am trying to render static HTML inside an Azure function from React-components with the help of: ReactDOMServer.renderToStaticMarkup(<HelloWorldPage />) where <HelloWorldPage /> is a React-component.

However, I receive SyntaxError: Unexpected identifier errors both on imports and use of React components inside my Azure function although i have imported react and react-dom.

My package.json looks like:

{
  "name": "experimental",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.5",
    "@testing-library/user-event": "^12.8.1",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.1.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

I am certain the solution to this is fairly simple, which makes it extra frustrating. But I do not know where to start. I would be infinitely grateful if someone could point me in the right direction. Thanks!

0 Answers0