DEV Community

Stylus07
Stylus07

Posted on

Change the document title on react application

As a beginner in react, i developed the application by running the one command create-react-app.

By default, the app will be generated with the below title

<title>React App</title>
Enter fullscreen mode Exit fullscreen mode

And it's pretty simple to change, just by having this life-cycle hook into your app file

  componentDidMount() {
    document.title = 'Custom Title';
  }
~~~~

Now your application title will be changed to your custom title
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
dance2die profile image
Sung M. Kim

I am wondering whether it'd affect SEO score in anyway, either positively or negatively.

Collapse
 
styluso7 profile image
Stylus07

I am not sure about this, but i would say the impact may be for a certain period until the new title is getting crawled by the search engine bots.