Closed RWOverdijk closed 9 years ago
You could accomplish this like so:
{
goToTweet: function(tweetData) {
var TweetPage = require('./pages/tweet')';
this.props.toRoute({
name: TweetPage.title,
component: TweetPage.component,
data: tweetData
});
}
}
with pages/tweet.js exporting:
module.exports = {
title: 'Tweet',
component: myTweetComponent
};
Alternatively this works as well:
{
goToTweet: function(tweetData) {
var TweetPage = require('./pages/tweet')';
this.props.toRoute({
name: TweetPage.displayName,
component: TweetPage,
data: tweetData
});
}
}
Just ensure you have the displayName property defined to your desired title on within your React.createClass
.
Satisfying enough. Thanks.
I've been playing around with this module a bit and so far it works really well. There's one thing that's bothering me though.. That's the name property. It looks like it's up to the initiator of the view to decide what the name of the view should be. For instance, on line 45 of HomePage.js in the twitter example:
The name is being defined there. What if the app has several places that initiate this? Would I have to add this all over the place? Can it be defined from within the page view itself, too?