Я использую Meteor и React Native, чтобы показать, какого заместителя выбрал пользователь. Если пользователь меняет своего заместителя, поле {number}
обновляется, а {depute.nom}
и {depute.groupe_sigle}
нет. Должен ли я использовать автозапуск трекера? Есть идеи ?
class Info extends Component {
render() {
const {nom, groupe_sigle, nom_circo, picture, num_circo, id} = this.props.navigation.state.params;
//This updates into the component
const number= Meteor.user().profile.selectedDeputy;
//This does not update into the component
const depute= this.props.selectedDeputy && this.props.selectedDeputy.depute;
return (
<View>
<Text>Your deputy is : {depute.nom}</Text>
<Text>Your deputy group is : {depute.groupe_sigle} </Text>
<Text>The deputy Id gets updated : {number} </Text>
</View>
)
}
}
export default createContainer(params=>{
Meteor.subscribe('selectedDeputy');
return{
selectedDeputy: Meteor.collection('deputies').findOne(Meteor.user().profile.selectedDeputy),
};
},info);