Answers for "react app title change"

2

react set title of page

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')
);
Posted by: Guest on July-15-2020
3

change title react

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')
);
Posted by: Guest on May-15-2020
0

how to change the title of create-react-app

You can find the source HTML file in the public folder of the generated project. 
You may edit the <title> tag in it to change the title from “React App” to anything else.
Posted by: Guest on June-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language