I use Meteor and React Native to display what deputy the user has selected. If the user changes his deputy, field {number} refreshes, but {depute.nom} and {depute.groupe_sigle} does not. Should I use Tracker Autorun ? Any idea ?
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);
First check the inserted data are there inside the database.If the data is not added to the database, there is an issue with your insert function.If the values are there in the database your subscribe should be inside autorun otherwise your data will not reactive.If you got conflicts please feel free to share you code with us