question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

route's title does not work

See original GitHub issue

I have the following routes:

mount({
	'/': route({
		title: 'Home',
		view: <Home />,
	}),
	'/about': route({
		title: 'About',
		view: <About />,
	}),
}))

but as it renders, the title of the browser tab is not set, is it expected behavior? I’m not using react-helmet and static rendering

Do I need to use react-helmet for it to work?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
linlycodecommented, Jul 19, 2019

I think it’s fine to let the router manage the title, router is responsible for rendering pages, title is a page property, so why not?

And I definitely wouldn’t like to manage titles in components, components are meant to be reused, composed, so it’s better to keep them away from global stuff and free from side effects.

Thus, I prefer letting the router do it. Anyway It’s just my opinion.

1reaction
kettanaitocommented, Jul 19, 2019

I wouldn’t let routing decide that. It falls out of its responsibility, imho. Instead, any rendered component (view) can render things that affect page’s title and other attributes. react-helmet, for instance, allows to control per-component title, meta, body and other attributes.

Those solutions usually provide API for server-side rendering. I’m brining this because it feels it would be too much for Navi to handle.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why I get this error trying to set page title? - angular
The Router sets the document's title using the title property from the Route config. But I get this error: Type '{ path: string;...
Read more >
Title does not change while changing routes - Next js 13 appDir
Expected Behavior. Title should change when the route changes. Link to reproduction - Issues with a link to complete (but minimal) reproduction ...
Read more >
How to Update the Application Title based on Routing ...
Just open the following link in your browser: https://luixaviles.github.io/angular-update-title. Find the complete angular project in this ...
Read more >
Setting Page Titles Natively With The Angular Router
First, you would use the data property in the Route object with a title ... Now, let's look at the new way page...
Read more >
Angular's new router title feature | by Kevin Kreuzer - Medium
In Angular v14 we don't have to implement the logic we explored above anymore. We simply have to use the new title property...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found