Skip to content

Commit

Permalink
Add code highlighting (#8)
Browse files Browse the repository at this point in the history
Co-authored-by: Albert Pérez <albert.perez@immfly.com>
  • Loading branch information
sonofjavascript and Albert Pérez authored Jun 25, 2020
1 parent e640af7 commit bee575b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Specify an http client with *get*, *post*, *put* and *delete* methods through the *ClientStore*. You can use *axios*, *fetch* or any other http client. [See Client Store](#client-store).

Define an actions object with this pattern for the common actions:
```
```js
const actions = {
...
ACTION_TYPE: (state, payload) => ({
Expand All @@ -36,7 +36,7 @@ The `request` key in the `ASYNC_ACTION` type indicates this action is asynchrono

Then, you only have to pass this actions objet to the `useAsync` hook.

```
```js
const [state, dispatch] = useAsync(actions, initialState)
```

Expand Down Expand Up @@ -65,7 +65,7 @@ Note: *the `*_SUCCESS` and `*_ERROR` actions are optionals.*
### Client store
Specify the client agent through the `ClientStore`.

```
```js
import React from 'react'

import { ClientStore } from '@sonofjs/use-async'
Expand All @@ -85,7 +85,7 @@ export default ViewContainer
### Actions, dispatches and state
Define the state actions and use the `useAsync` hook to manage it.

```
```js
import React, { useEffect } from 'react'
import useAsync from '@sonofjs/use-async'

Expand Down Expand Up @@ -172,7 +172,7 @@ export default Component
### Custom client agent
Interceptors and other methods can be used meanwhile the client agent is used by the `asyncAction` hook. To connect the client to the store and use its state data implement a method named `connect` in your client.

```
```js
/* Your client agent */
import axios from 'axios'

Expand Down

0 comments on commit bee575b

Please sign in to comment.