Javascript 如何使用Redux将徽章值传递到React Native上的底部选项卡栏
如何使用Redux更改底部选项卡栏上的徽章值 底部选项卡栏上带有Redux(99+)的值标记,我想用Redux中的值更改它 连接Javascript 如何使用Redux将徽章值传递到React Native上的底部选项卡栏,javascript,reactjs,react-native,react-redux,reducers,Javascript,Reactjs,React Native,React Redux,Reducers,如何使用Redux更改底部选项卡栏上的徽章值 底部选项卡栏上带有Redux(99+)的值标记,我想用Redux中的值更改它 连接 您需要创建一个新组件来处理状态更改 class Mybadge extends Component { constructor() { super(); this.state = { num:99 }; //call the following function to set badge number funct
您需要创建一个新组件来处理状态更改
class Mybadge extends Component {
constructor() {
super();
this.state = {
num:99
};
//call the following function to set badge number
functionToSetBadgeNum(num){
this.setState({num:num})
}
render(){
return (<Badge value={this.state.num} status="error" />)
}
}
类Mybadge扩展组件{
构造函数(){
超级();
此.state={
总数:99
};
//调用以下函数设置徽章编号
functionToSetBadgeNum(num){
this.setState({num:num})
}
render(){
返回()
}
}
现在,您可以添加新组件而不是徽章组件。谢谢,现在我可以从redux中添加价值徽章了!