Skip to content

Commit

Permalink
- Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
v-jaebe committed Nov 14, 2018
1 parent dc3dbd1 commit 282809a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

>
[![NPM](https://img.shields.io/npm/v/react-hook-utils.svg)](https://www.npmjs.com/package/react-hook-utils)
[![CircleCI](https://circleci.com/gh/jacob-ebey/react-hook-utils.svg?style=svg)](https://circleci.com/gh/jacob-ebey/react-hook-utils) [![Coverage Status](https://coveralls.io/repos/github/jacob-ebey/react-hook-utils/badge.svg?branch=master)](https://coveralls.io/github/jacob-ebey/react-hook-utils?branch=master) [![NPM](https://img.shields.io/npm/v/react-hook-utils.svg)](https://www.npmjs.com/package/react-hook-utils)

## Install

Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<div class="content" data-ice="content"><div data-ice="index" class="github-markdown"><h1 id="react-hook-utils">react-hook-utils</h1><blockquote>
</blockquote>
<p><a href="https://www.npmjs.com/package/react-hook-utils"><img src="https://img.shields.io/npm/v/react-hook-utils.svg" alt="NPM"></a></p>
<p><a href="https://circleci.com/gh/jacob-ebey/react-hook-utils"><img src="https://circleci.com/gh/jacob-ebey/react-hook-utils.svg?style=svg" alt="CircleCI"></a> <a href="https://coveralls.io/github/jacob-ebey/react-hook-utils?branch=master"><img src="https://coveralls.io/repos/github/jacob-ebey/react-hook-utils/badge.svg?branch=master" alt="Coverage Status"></a> <a href="https://www.npmjs.com/package/react-hook-utils"><img src="https://img.shields.io/npm/v/react-hook-utils.svg" alt="NPM"></a></p>
<h2 id="install">Install</h2><pre><code class="lang-bash"><code class="source-code prettyprint">npm install --save react-hook-utils</code>
</code></pre>
<h2 id="documentation">Documentation</h2><p><a href="https://jacob-ebey.github.io/react-hook-utils/">https://jacob-ebey.github.io/react-hook-utils/</a></p>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -1125,15 +1125,15 @@
},
{
"kind": "index",
"content": "# react-hook-utils\n\n>\n\n[![NPM](https://img.shields.io/npm/v/react-hook-utils.svg)](https://www.npmjs.com/package/react-hook-utils)\n\n## Install\n\n```bash\nnpm install --save react-hook-utils\n```\n\n## Documentation\n\nhttps://jacob-ebey.github.io/react-hook-utils/\n\n## Usage\n\n### Global Reducer\n\nCreate a global reducer for re-use in components:\n\n```jsx\n// useCount.js\nimport { globalReducer } from \"react-hook-utils\";\n\nexport default globalReducer(\n { count: 0 },\n {\n decrement: state => ({\n ...state,\n count: state.count - 1\n }),\n increment: state => ({\n ...state,\n count: state.count + 1\n })\n set: (state, count) => ({\n ...state,\n count\n }),\n }\n);\n```\n\nUse the reducer within a component:\n\n```jsx\nimport React, { useCallback } from \"react\";\n\nimport useCount from \"./useCount\";\n\nexport function CountControls() {\n // Select only the count property from the state\n const [count, { decrement, increment, set }] = useCount(s => s.count);\n\n // Create a callback to reset the count\n const reset = useCallback(() => set(0), [set]);\n\n return (\n <div>\n <button onClick={decrement}>-</button>\n {count}\n <button onClick={increment}>+</button>\n <br />\n <button onClick={reset}>Reset</button>\n </div>\n );\n}\n```\n\n### Use Promise\n\nIn the following example, API.getUserAsync returns a Promise. We combine usePromise with useMemo as follows to only make an API call when the userId changes:\n\n```jsx\nimport React, { useMemo } from \"react\";\nimport { usePromise } from \"react-hook-utils\";\n\nimport API from \"./api\";\n\nexport function UserView({ userId }) {\n const [user, error, loading] = usePromise(\n useMemo(() => API.getUserAsync(userId), [userId])\n );\n\n if (loading) {\n return <div>Loading...</div>;\n } else if (error) {\n return <div>Something went wrong :(</div>;\n }\n\n return <div>Hello, {user.name}</div>;\n}\n```\n\n## License\n\nMIT © [](https://github.com/)\n",
"content": "# react-hook-utils\n\n>\n\n[![CircleCI](https://circleci.com/gh/jacob-ebey/react-hook-utils.svg?style=svg)](https://circleci.com/gh/jacob-ebey/react-hook-utils) [![Coverage Status](https://coveralls.io/repos/github/jacob-ebey/react-hook-utils/badge.svg?branch=master)](https://coveralls.io/github/jacob-ebey/react-hook-utils?branch=master) [![NPM](https://img.shields.io/npm/v/react-hook-utils.svg)](https://www.npmjs.com/package/react-hook-utils)\n\n## Install\n\n```bash\nnpm install --save react-hook-utils\n```\n\n## Documentation\n\nhttps://jacob-ebey.github.io/react-hook-utils/\n\n## Usage\n\n### Global Reducer\n\nCreate a global reducer for re-use in components:\n\n```jsx\n// useCount.js\nimport { globalReducer } from \"react-hook-utils\";\n\nexport default globalReducer(\n { count: 0 },\n {\n decrement: state => ({\n ...state,\n count: state.count - 1\n }),\n increment: state => ({\n ...state,\n count: state.count + 1\n })\n set: (state, count) => ({\n ...state,\n count\n }),\n }\n);\n```\n\nUse the reducer within a component:\n\n```jsx\nimport React, { useCallback } from \"react\";\n\nimport useCount from \"./useCount\";\n\nexport function CountControls() {\n // Select only the count property from the state\n const [count, { decrement, increment, set }] = useCount(s => s.count);\n\n // Create a callback to reset the count\n const reset = useCallback(() => set(0), [set]);\n\n return (\n <div>\n <button onClick={decrement}>-</button>\n {count}\n <button onClick={increment}>+</button>\n <br />\n <button onClick={reset}>Reset</button>\n </div>\n );\n}\n```\n\n### Use Promise\n\nIn the following example, API.getUserAsync returns a Promise. We combine usePromise with useMemo as follows to only make an API call when the userId changes:\n\n```jsx\nimport React, { useMemo } from \"react\";\nimport { usePromise } from \"react-hook-utils\";\n\nimport API from \"./api\";\n\nexport function UserView({ userId }) {\n const [user, error, loading] = usePromise(\n useMemo(() => API.getUserAsync(userId), [userId])\n );\n\n if (loading) {\n return <div>Loading...</div>;\n } else if (error) {\n return <div>Something went wrong :(</div>;\n }\n\n return <div>Hello, {user.name}</div>;\n}\n```\n\n## License\n\nMIT © [](https://github.com/)\n",
"longname": "C:\\Source\\react-hook-utils\\README.md",
"name": "./README.md",
"static": true,
"access": "public"
},
{
"kind": "packageJSON",
"content": "{\n \"name\": \"react-hook-utils\",\n \"version\": \"1.0.1\",\n \"description\": \"\",\n \"author\": \"\",\n \"license\": \"MIT\",\n \"repository\": \"https://github.com/jacob-ebey/react-hook-utils.git\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.es.js\",\n \"jsnext:main\": \"dist/index.es.js\",\n \"engines\": {\n \"node\": \">=8\",\n \"npm\": \">=5\"\n },\n \"scripts\": {\n \"test\": \"cross-env CI=1 react-scripts test --env=jsdom\",\n \"coverage\": \"cross-env CI=1 react-scripts test --coverage --env=jsdom\",\n \"test:watch\": \"react-scripts test --env=jsdom\",\n \"build\": \"rollup -c && esdoc\",\n \"start\": \"rollup -c -w\",\n \"prepare\": \"npm run build\",\n \"predeploy\": \"cd example && npm install && npm run build\",\n \"deploy\": \"gh-pages -d example/build\"\n },\n \"peerDependencies\": {\n \"react\": \"^16.7.0-alpha.0\",\n \"react-dom\": \"^16.7.0-alpha.0\",\n \"scheduler\": \"^0.11.0-alpha.0\"\n },\n \"devDependencies\": {\n \"@svgr/rollup\": \"^2.4.1\",\n \"babel-core\": \"^6.26.3\",\n \"babel-eslint\": \"^8.2.5\",\n \"babel-plugin-external-helpers\": \"^6.22.0\",\n \"babel-preset-env\": \"^1.7.0\",\n \"babel-preset-react\": \"^6.24.1\",\n \"babel-preset-stage-0\": \"^6.24.1\",\n \"cross-env\": \"^5.1.4\",\n \"esdoc\": \"^1.1.0\",\n \"esdoc-standard-plugin\": \"^1.0.0\",\n \"eslint\": \"^5.0.1\",\n \"eslint-config-standard\": \"^11.0.0\",\n \"eslint-config-standard-react\": \"^6.0.0\",\n \"eslint-plugin-import\": \"^2.13.0\",\n \"eslint-plugin-node\": \"^7.0.1\",\n \"eslint-plugin-promise\": \"^4.0.0\",\n \"eslint-plugin-react\": \"^7.10.0\",\n \"eslint-plugin-standard\": \"^3.1.0\",\n \"gh-pages\": \"^1.2.0\",\n \"react\": \"16.7.0-alpha.0\",\n \"react-dom\": \"16.7.0-alpha.0\",\n \"react-scripts\": \"^1.1.4\",\n \"react-testing-library\": \"^5.2.3\",\n \"rollup\": \"^0.64.1\",\n \"rollup-plugin-babel\": \"^3.0.7\",\n \"rollup-plugin-commonjs\": \"^9.1.3\",\n \"rollup-plugin-node-resolve\": \"^3.3.0\",\n \"rollup-plugin-peer-deps-external\": \"^2.2.0\",\n \"rollup-plugin-postcss\": \"^1.6.2\",\n \"rollup-plugin-url\": \"^1.4.0\",\n \"scheduler\": \"0.11.0-alpha.0\"\n },\n \"files\": [\n \"dist\",\n \"README.md\"\n ]\n}\n",
"content": "{\n \"name\": \"react-hook-utils\",\n \"version\": \"1.0.2\",\n \"description\": \"\",\n \"author\": \"\",\n \"license\": \"MIT\",\n \"repository\": \"https://github.com/jacob-ebey/react-hook-utils.git\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.es.js\",\n \"jsnext:main\": \"dist/index.es.js\",\n \"engines\": {\n \"node\": \">=8\",\n \"npm\": \">=5\"\n },\n \"scripts\": {\n \"test\": \"cross-env CI=1 react-scripts test --coverage --env=jsdom\",\n \"coveralls\": \"cat ./coverage/lcov.info | coveralls\",\n \"test:watch\": \"react-scripts test --env=jsdom\",\n \"build\": \"rollup -c && esdoc\",\n \"start\": \"rollup -c -w\",\n \"prepare\": \"npm run build\",\n \"predeploy\": \"cd example && npm install && npm run build\",\n \"deploy\": \"gh-pages -d example/build\"\n },\n \"peerDependencies\": {\n \"react\": \"^16.7.0-alpha.0\",\n \"react-dom\": \"^16.7.0-alpha.0\",\n \"scheduler\": \"^0.11.0-alpha.0\"\n },\n \"devDependencies\": {\n \"@svgr/rollup\": \"^2.4.1\",\n \"babel-core\": \"^6.26.3\",\n \"babel-eslint\": \"^8.2.5\",\n \"babel-plugin-external-helpers\": \"^6.22.0\",\n \"babel-preset-env\": \"^1.7.0\",\n \"babel-preset-react\": \"^6.24.1\",\n \"babel-preset-stage-0\": \"^6.24.1\",\n \"coveralls\": \"^3.0.2\",\n \"cross-env\": \"^5.1.4\",\n \"esdoc\": \"^1.1.0\",\n \"esdoc-standard-plugin\": \"^1.0.0\",\n \"eslint\": \"^5.0.1\",\n \"eslint-config-standard\": \"^11.0.0\",\n \"eslint-config-standard-react\": \"^6.0.0\",\n \"eslint-plugin-import\": \"^2.13.0\",\n \"eslint-plugin-node\": \"^7.0.1\",\n \"eslint-plugin-promise\": \"^4.0.0\",\n \"eslint-plugin-react\": \"^7.10.0\",\n \"eslint-plugin-standard\": \"^3.1.0\",\n \"gh-pages\": \"^1.2.0\",\n \"react\": \"16.7.0-alpha.0\",\n \"react-dom\": \"16.7.0-alpha.0\",\n \"react-scripts\": \"^1.1.4\",\n \"react-testing-library\": \"^5.2.3\",\n \"rollup\": \"^0.64.1\",\n \"rollup-plugin-babel\": \"^3.0.7\",\n \"rollup-plugin-commonjs\": \"^9.1.3\",\n \"rollup-plugin-node-resolve\": \"^3.3.0\",\n \"rollup-plugin-peer-deps-external\": \"^2.2.0\",\n \"rollup-plugin-postcss\": \"^1.6.2\",\n \"rollup-plugin-url\": \"^1.4.0\",\n \"scheduler\": \"0.11.0-alpha.0\"\n },\n \"files\": [\n \"dist\",\n \"README.md\"\n ]\n}\n",
"longname": "C:\\Source\\react-hook-utils\\package.json",
"name": "package.json",
"static": true,
Expand Down
4 changes: 2 additions & 2 deletions docs/source.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@
<td class="coverage"><span data-ice="coverage">42 %</span><span data-ice="coverageCount" class="coverage-count">3/7</span></td>
<td style="display: none;" data-ice="size">6697 byte</td>
<td style="display: none;" data-ice="lines">255</td>
<td style="display: none;" data-ice="updated">2018-11-04 00:00:40 (UTC)</td>
<td style="display: none;" data-ice="updated">2018-11-04 00:19:09 (UTC)</td>
</tr>
<tr data-ice="file">
<td data-ice="filePath"><span><a href="file/dist/index.js.html#errorLines=22,36,5,7,74">dist/index.js</a></span></td>
<td data-ice="identifier" class="identifiers">-</td>
<td class="coverage"><span data-ice="coverage">37 %</span><span data-ice="coverageCount" class="coverage-count">3/8</span></td>
<td style="display: none;" data-ice="size">6850 byte</td>
<td style="display: none;" data-ice="lines">261</td>
<td style="display: none;" data-ice="updated">2018-11-04 00:00:40 (UTC)</td>
<td style="display: none;" data-ice="updated">2018-11-04 00:19:09 (UTC)</td>
</tr>
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-hook-utils",
"version": "1.0.1",
"version": "1.0.2",
"description": "",
"author": "",
"license": "MIT",
Expand Down

0 comments on commit 282809a

Please sign in to comment.