I want change the title of a class, and I achieve it with document.title = "flayers" but I put this code in the constructor,then firt I have a default title and change it then when I refer to the url, show the old title.
first I have this title
I don't know if I explain :D
Are you familiar with React-Router? You can change the name of the title page by placing a componentDidMount in the desired component, which will fire when the component is loaded. Then, you'll simply use document.title to target and change the page's title.
Here's an example , which I took from issue ticket #49 in the React-Router Github repository:
var Handler = React.createClass({
componentDidMount: function() {
document.title = "Amazing Page";
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.