From d52a89d9f877b0e38ad05b181b25db2cfa4ad591 Mon Sep 17 00:00:00 2001 From: Tyler McGinnis Date: Thu, 3 Sep 2015 15:49:53 +0100 Subject: [PATCH] Add ability to make titles dynamic --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 6fcd4b731..b33721dac 100644 --- a/index.js +++ b/index.js @@ -104,10 +104,14 @@ class Router extends React.Component { self.setState({initialRoute: child.props}); } if (!(RouterActions[name])) { - RouterActions[name] = function (data) { + RouterActions[name] = function (data, dynamicTitle) { if (typeof(data)!='object'){ data={data:data}; } + if(dynamicTitle){ + var updatedRoute = Object.assign({}, self.routes[name], {title: dynamicTitle}); + self.routes[name] = updatedRoute; + } var args = {name: name, data:data}; RouterActions.push(args); }