Use react-tunnels to update App Title
filipenevola opened this issue · 3 comments
filipenevola commented
Use react-tunnels to update App Title
filipenevola commented
@denihs Example in case you want to do that:
Utility functions
export const updateAppTitle = title => {
if (document) {
document.title = title ? `${title} | TODO App` : 'TODO App';
}
return <Tunnel id="app-title">{title || 'TODO App'}</Tunnel>;
};
export const resetAppTitle = () => updateAppTitle('TODO App');
Render from main client file
<Provider store={store}>
<ApolloProvider client={client}>
<MuiThemeProvider theme={theme}>
<TunnelProvider>
<BrowserRouter>
<AppContainer />
</BrowserRouter>
</TunnelProvider>
</MuiThemeProvider>
</ApolloProvider>
</Provider>
How to use:
<Fragment>
{updateAppTitle('Grupos')}
<div className="center-message">
Nenhum grupo cadastrado!<br />Clique no botão abaixo e cadastre!
</div>
{addGroup}
</Fragment>
dependency:
meteor npm install --save react-tunnels
denihs commented
Done!
filipenevola commented
Nice. You rock @denihs!