I am using React and employing the createContainer method to gather data, that then inserts it into the component. The component contains a form the the user submits and saves some information to the database. If the user moves onto another page in my application, then comes back to this page, I want the form to be populated with the previously saved information - not sure how to do this!?
Container:
export default createContainer(({ params }) => {
const dataHandle = Meteor.subscribe('MyPub');
const dataIsReady = dataHandle.ready();
return {
data: dataIsReady ? MyColl.find().fetch() : []
};
}, MyComponent);
Component:
export default class MyComponent extends React.Component {
constructor(props) {
super(props);
}
save(){
// This saves something to the database and receives a Mongo _id.
...
}
render(){
return (
<div>
...
<button onClick={this.save.bind(this)}>Save</button>
...
</div>
);
}
}