title: how in XState machine to do action send('EVENT_NAME', {to:'something from context'})?
body: <p>I need send event to another spawned state machine that its ID I have as a string in a variable in the context. (it is not parent state machine and not child)</p>
  
  <p>Like </p>
  
  <p><code>context.sendTo = 'B_id'</code></p>
  
  <p>how to do <code>send()</code> with parameter from context? </p>
  
  <p>and how to put <code>send('MY_EVENT_NAME', {to: &lt;something from context&gt; })</code> in the <code>MachineOptions</code> <code>actions</code> section?</p>
  
  <pre><code>
  // this does not work...
  const myMachineOptions:Partial&lt;MachineOptions&lt;any,any&gt;&gt; = 
  {
    actions:{
       mySend: (context, event)=&gt;send('MY_EVENT_NAME', {to: context.sendTo })
    }
  }
  
  </code></pre>
  
  <p>P.S.</p>
  
  <p>it like in the 
  <a href="https://stackoverflow.com/questions/54919831/pass-values-when-sending-events-from-one-machine-to-another-in-xstate">Pass values when sending events from one machine to another in xState</a></p>
  
  <p>but what I need to by dynamic is not the message body but the <code>to:</code> part </p>