title: Can a Promise value be sent to a function inside next() instead of a callback inside next()?
body: <p><strong>Question:</strong>  Can a Promise value be sent to a function inside <code>next()</code> instead of a callback inside <code>next()</code>?</p>
  
  <p><strong>Background:</strong> The following standard <code>Promise</code> pattern works as expected.  <em>x equals 1</em> is sent to the console.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function promisesPromises() {
    return new Promise(function(resolve, reject) {
      let x = 1;
      if (x === 1) {
        resolve('x equals 1');
      } else {
        reject('x does not equal 1');
      }
    });
  }
  
  promisesPromises()
    .then(function(data) {
      console.log(data);
    });</code></pre>
  </div>
  </div>
  </p>
  
  <p>However when I call a function inside <code>.then()</code> instead of a callback function it throws an error.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function promisesPromises() {
    return new Promise(function(resolve, reject) {
      let x = 1;
      if (x === 1) {
        resolve('x equals 1');
      } else {
        reject('x does not equal 1');
      }
    });
  }
  
  function linkOne(data) {
    console.log(data);
  }
  
  promisesPromises()
    .then(linkOne(data));</code></pre>
  </div>
  </div>
  </p>
  
  <blockquote>
    <p>ReferenceError: data is not defined</p>
  </blockquote>
  
  <p>I can overcome this by placing the function inside of the callback function but this seems clunky.  </p>
  
  <pre><code>promisesPromises()
      .then( function(data) {
          linkOne(data);
      });
  </code></pre>
  
  <p>Is there another pattern that accomplishes the same goal without placing a function inside of a callback?</p>