import React, { useEffect } from 'react'
import ReactDOM from 'react-dom'
const App = () => {
// This effect runs once, after the first render
useEffect(() => {
document.title = "This is a title"
}, [])
return <h1>Hello, World!</h1>
};
ReactDOM.render(
<App />,
document.getElementById('root')
);
import React from 'react'
import ReactDOM from 'react-dom'
class Doc extends React.Component{
componentDidMount(){
document.title = "dfsdfsdfsd"
}
render(){
return(
<b> test </b>
)
}
}
ReactDOM.render(
<Doc />,
document.getElementById('container')
);
go to public folder
change title of index.html file
/*
yourApp/public/index.html (you boot the project from the App.js which is located at yourApp/App.js (same level as the public folder)
change the <title>React App</title> to <title>Whatever You Want<title> and Whatever You Want will be the new page title
*/