Comments (2)
In my project, I do this via a wrapper component:
'use strict';
var React = require('react'),
ReactDocumentTitle = require('react-document-title'),
PureRenderMixin = require('../mixins/PureRenderMixin');
var DocumentTitle = React.createClass({
mixins: [PureRenderMixin],
render() {
var title = this.props.title;
if (!title) {
title = 'Stampsy';
} else {
title += ' ยท Stampsy';
}
return (
<ReactDocumentTitle title={title}>
{this.props.children}
</ReactDocumentTitle>
);
}
});
module.exports = DocumentTitle;
I agree it would be nice to have in the component itself, but I'd want to support arbitrary formatting in this case (and not just prepending/appending).
from react-document-title.
I'll close this out since it's achievable by wrapping component.
from react-document-title.
Related Issues (20)
- mistake
- Blocks context propagation HOT 3
- Memory leak on server side! HOT 7
- React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. HOT 4
- Patch release 2.0.3 with new dependencies
- Should use the deepest truthy value
- Suffix support? HOT 2
- Support export.default? HOT 1
- Use of React.Children.only() HOT 2
- Leads to memory leaks when it's used with renderToString HOT 2
- TypeError: Cannot read property 'string' of undefined at eval HOT 1
- Keep seeing warnings about missing 'key' prop for DocumentTitle HOT 2
- Upgrade to ESM
- Support FormattedMessage from react-intl HOT 3
- Readme file Reservations
- DocumentTitle is undefined when running tests HOT 5
- Issues with importing when using TypeScript HOT 3
- When I use it.Why components has been an empty object at this.props?
- Warning: componentWillMount has been renamed โ SideEffect(DocumentTitle) HOT 17
- Fix DT Typing to indicate only one child HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-document-title.