Meteor + React + Mantra: Use LocalState to pass action result to a component?

Hi guys, I’m using the LocalState to send back actions result to a component and I’m wondering if it’s the good way to do that.

Action:'', params, (err, flats) => {

  if (err) {
    LocalState.set('SEARCH_FLAT_ERROR', err.message);
    LocalState.set('FLAT_RESULT', NO_FLAT_FOUND);
    return null;

  LocalState.set('FLAT_RESULT', flats);


const flats = LocalState.get('FLAT_RESULT') ? LocalState.get('FLAT_RESULT') : []; onData(null, {errorMessages, flats});


const {flats} = this.props;
{ (flat, idx) => (

Is there a better way to do that, if yes please help me !!


This topic is bit old but actual in my case. Is this way of getting data is recommended?
@ngouana did you managed to find any other solutions if not is the above solution works for you?

Hi @mipasov, Using the LocalState is actually the recommended pattern as pointed in Mantra specifications.

1 Like

Hi @ngouana ,

I have little difficulties in realizing this in my code.
In my container I am subscribing to some data and passing data trough onData() . Could you please give some hints, how to pass data which set through actions again by onData(), on same container?

Something like:

subscribe to publication.
  if no error

   call method
      if no error

on same container: 
  const data=LocalState.get('DATA');  
\\how it will be possible to pass data ? 


Hi @mipasov,

this link should help: