javascript - Making a single-page application with react, how do you handle the titles of different pages?
巴扎黑
巴扎黑 2017-05-19 10:23:41
0
3
493

Recently used react to create a single page page. Because there is only one main entrance.html that is rendered in the end. Render different components through routing. Is there any way to display the corresponding title through different components. Just use WeChat to open a page and the title part of the header.

巴扎黑
巴扎黑

reply all(3)
滿天的星座

It’s actually very simple

document.title = '标题'
给我你的怀抱

To make it simple, just use document.title="xxx" yourself.

To be more standardized, use react-document-title to encapsulate it.

But for WeChat, I don’t know if it can be used on ios.

phpcn_u1582

Use document.title in componentWillMount

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template