how to move react js app to heroku code example

Example 1: react scrip for deplot heroku

"scripts": { 
  "dev": "react-scripts 
  "start", "start": "serve -s build", 
  "build": "react-scripts build", 
  "test": "react-scripts test --env=jsdom",
  "eject": "react-scripts eject", 
  "heroku-postbuild": "npm run build" 
},

Example 2: deploy react app to heroku

const path = require('path');const express = require('express');const app = express();const publicPath = path.join(__dirname, '..', 'public');const port = process.env.PORT || 3000;app.use(express.static(publicPath));app.get('*', (req, res) => {   res.sendFile(path.join(publicPath, 'index.html'));});app.listen(port, () => {   console.log('Server is up!');});