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.

16 Libraries You Should Know as a React Developer

Being a modern React developer is not about knowing just React itself. To stay competitive, it is highly recommended to explore the whole ecosystem. This article contains some of the most useful React component libraries to speed up your developer workflow.