Skip to content

Commit

Permalink
fix(readme): amend readme and add threshold for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanRoll committed Aug 17, 2019
1 parent e77eaf3 commit 008f3b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div align="center">
<h1>
<br/>
<br/>
React Use API
<br />
Expand All @@ -15,12 +14,10 @@
![npm type definitions](https://img.shields.io/npm/types/react-use-api?color=0277BD)
![GitHub](https://img.shields.io/github/license/RyanRoll/react-use-api?color=5C6BC0)

> [Axios](https://github.com/axios/axios)-based React hooks for async HTTP request data. Designed for diverse UI states as well as SSR (server-side rendering) and data pre-cache.
[Axios](https://github.com/axios/axios)-based React hooks for async HTTP request data. `react-use-api` feeds API data to React components when SSR (Server-Side Rendering), and caches the data to Front-End. This is designed for diverse UI states and also a good solution if your app is based on [create-react-app](https://create-react-app.dev).

> TypeScript Support
> Not only cache api data but also feed it into React components when SSR
> Thread-safe SSR
## Installation
Expand Down Expand Up @@ -50,8 +47,8 @@ import useApi, { ApiProvider } from 'react-use-api'

import App from './App'

// theres is only one prop parameter "context", which is must given for SSR,
// the client side can omit it
// there is only one props "context", which is must given for SSR,
// client side can omit it
ReactDom.render(
<ApiProvider>
<App />
Expand Down Expand Up @@ -301,7 +298,7 @@ _Each property of settings is optional_
| renderSSR | Function | () => '' | A callback to render SSR string for injectSSRHtml() |
| isSSR | Function | () => typeof window === 'undefined' | A function to determine if the current environment is server |
| debug | boolean | true | Set true to get debug message from console |
| clientCacheVar | string | '**USE_API_CACHE**' | The JS variable name of cache data |
| clientCacheVar | string | 'USE_API_CACHE' | The JS variable name of cache data |

##### Arguments of injectSSRHtml

Expand Down
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,12 @@ module.exports = {
verbose: true,
collectCoverage: false,
coverageReporters: ['html', 'text-lcov'],
coverageThreshold: {
"global": {
"branches": 90,
"functions": 90,
"lines": 90,
"statements": 90
}
}
}

0 comments on commit 008f3b0

Please sign in to comment.