Skip to content

Commit

Permalink
Add documentation for using boundActionCreators fixes #4029 (#4042)
Browse files Browse the repository at this point in the history
* Add documentation for using boundActionCreators

* Update bound-action-creators.js

* Fix
  • Loading branch information
ajayns authored and KyleAMathews committed Feb 15, 2018
1 parent dbb3237 commit 243a726
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions www/src/pages/docs/bound-action-creators.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ class ActionCreatorsDocs extends React.Component {
and dispatch Redux actions when called) which you can use to
manipulate state on your site.
</p>
<p>
The object
{` `}
<code>boundActionCreators</code>
{` `}
contains the functions and these can be individually extracted by
using ES6 object destructuring.
</p>
<pre
dangerouslySetInnerHTML={{
__html: `
<code class=" language-javascript"><span class="token comment">// For function createNodeField</span>
exports<span class="token punctuation">.</span><span class="token function-variable function">onCreateNode</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">{</span> node<span class="token punctuation">,</span> getNode<span class="token punctuation">,</span> boundActionCreators <span class="token punctuation">}</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
<span class="token keyword">const</span> <span class="token punctuation">{</span> createNodeField <span class="token punctuation">}</span> <span class="token operator">=</span> boundActionCreators
<span class="token punctuation">}</span></code>
`,
}}
/>
<h2 css={{ marginBottom: rhythm(1 / 2) }}>Functions</h2>
<ul css={{ ...scale(-1 / 5) }}>
{this.props.data.allDocumentationJs.edges.map(({ node }, i) => (
Expand Down

0 comments on commit 243a726

Please sign in to comment.