Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
harryhope authored Sep 2, 2020
1 parent c89be51 commit 6b10021
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ <h3 id="usehookedonstate">useHookedOnState</h3>
<p><strong>Arguments</strong></p>
<p><code>selector</code>: <em>(string)</em> Takes a path string similar to what you would use in <a href="https://lodash.com/docs/4.17.15#set">lodash's <code>_.set</code></a>. This path specifies the "slice" of the store that you will be modifying.</p>
<p><code>defaultState</code>: <em>(any)</em> This is the default value that will be used if the "slice" of the store specified by <code>selector</code> is empty. It works very similarly to <a href="https://reactjs.org/docs/hooks-state.html"><code>useState</code></a>'s default state.</p>
<p><code>namespace</code>: <em>(string)</em> If you are using a custom namespace for <code>createHookedOnReducer</code> then you must specify that namespace as the third parameter. If you are not using a default namespace then you can ignore this. <strong>Default Value:</strong> <code>'HOOKED_ON_REDUX'</code></p>
<p><code>options</code>: <em>(object)</em> A configuration object that may contain the following properties:</p>
<p>&bull; <code>namespace</code>: <em>(string)</em> If you are using a custom namespace for <code>createHookedOnReducer</code> then you must specify that namespace as the third parameter. If you are not using a default namespace then you can ignore this. <strong>Default Value:</strong> <code>'HOOKED_ON_REDUX'</code></p>
<p>&bull; <code>rootPath</code>: <em>(string)</em> If the Hooked on Redux reducer is not at the root level of your store, you must specify the subpath it exists on with this parameter. This usually happens if you integrate Hooked on Redux into a larger Redux codebase using something like <code>combineReducers</code>. For instance, if the Hooked on Redux reducer is added to the combined reducers with the name <code>myReducer</code>, then <code>rootPath</code> should be <code>myReducer</code> as well. For a nested path you may specify a path such as <code>path.to.my.store.</code></p>
<p><strong>Returns:</strong> <em>(array)</em> <code>[value, updateValue]</code> This function returns a "tuple" much like <a href="https://reactjs.org/docs/hooks-state.html"><code>useState</code></a>. The first array element <code>value</code> is the value at the slice of state. The second element of the array <code>updateValue</code> is a function that accepts a single parameter that updates the global state at the slice of state specified by <code>selector</code>.</p>
<h2 id="prior-art">Prior Art</h2>
<p>Hooked on Redux builds very heavily on existing libraries and concepts. Under-the-hood it leverages <a href="https://github.com/substantial/updeep">updeep</a> and <a href="https://github.com/algolia/redux-updeep">redux-updeep</a> to do most of the work updating the state tree, and the library is particularly inspired by redux-updeep: See <a href="https://blog.algolia.com/how-we-reduced-boilerplate-and-handled-asynchronous-actions-with-redux/">How we reduced boilerplate and handled asynchronous actions with Redux</a>.</p></main>
Expand Down

0 comments on commit 6b10021

Please sign in to comment.