我对reactjs有些新意。在 React.createclass 元素中,您可以访问输入值或任何状态值,例如
change: function(e) {
this.setState({author: e.target.value});
},
但是在 React.component 中这是不可能的,那么如何在 React.component
中实现类似的任务呢?由于
答案 0 :(得分:3)
如果要将方法传递给此UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UITabBarController *tabbarController = [storyboard instantiateViewControllerWithIdentifier : @"MyTabBarController"];
NSMutableArray *tabbarItems = [NSMutableArray arrayWithArray : tabbarController.viewControllers];
BOOL communityFlag = false;
for (UINavigationController *nav in tabbarItems) {
if([nav.restorationIdentifier isEqualToString : @"RegisterStoryboardID"]) {
[tabbarItems removeObject : nav];
break;
}
if([nav.restorationIdentifier isEqualToString:@"CommunityStoryboardID"]) {
communityFlag = true;
break;
}
}
if(!communityFlag) {
UINavigationController *controller = [storyboard instantiateViewControllerWithIdentifier:@"CommunityStoryboardID"];
[tabbarItems addObject : controller];
}
[self.tabBarController setViewControllers:[NSArray arrayWithArray:tabbarItems]];
之类的事件处理程序并使用onChange={ this.change }
类,则必须自行为这些方法设置ES2015
,例如
this