Skip to content

Commit

Permalink
Docs: update README
Browse files Browse the repository at this point in the history
* prettier example code snippets
  • Loading branch information
lintuming committed Sep 9, 2019
1 parent ca8e7a2 commit 8b0d00f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,26 @@ The list of hooks are avaliable:

```js
npm install react-shallow-hooks
# or
# use yarn
yarn add react-shallow-hooks
```

## Usage

```js
import {useShallowEffect} 'react-shallow-hooks'
import { useShallowEffect, useShallowCallback } 'react-shallow-hooks'

const useSomething=()=>{
const deps={
a:123,
b:123
}
//The effect callback only call once ,and won't call on every re-render;
//shallowEqual(deps,previousdeps)===true
useShallowEffect(()=>{
console.log('update')
},[deps])

const shallowCallback=useShallowEffect(()=>console.log('callback'),[deps])

}
```
Expand Down

0 comments on commit 8b0d00f

Please sign in to comment.