)}
@@ -297,9 +279,11 @@ const myNestedData = props => (
### Debouncing requests
-Do you rely on a text input to sending different requests? Or even worst on a mouse event? No problem! The `Get` component have a `debounce` prop to deal with this kind of tricky cases :tada:
+Some requests fire in response to a rapid succession of user events: things like autocomplete or resizing a window. For this reason, users sometimes need to wait until all the keystrokes are typed (until everything's _done_), before sending a request.
-We simply use `lodash.debounce` and you can give more or less options regarding your specific needs.
+Restful React exposes a `debounce` prop on `Get` that does exactly this.
+
+Here's an example:
```jsx
const SearchThis = props => (
@@ -307,18 +291,14 @@ const SearchThis = props => (
{data => (
Here's all the things I search
-
- {data.map(thing => (
-
{thing}
- ))}
-
+
{data.map(thing =>
{thing}
)}
)}
);
```
-or with the `wait` params
+Debounce also accepts a number, which tells `Get` how long to wait until doing the request.
```jsx
const SearchThis = props => (
@@ -326,18 +306,14 @@ const SearchThis = props => (
{data => (
Here's all the things I search
-
- {data.map(thing => (
-
{thing}
- ))}
-
+
{data.map(thing =>
{thing}
)}
)}
);
```
-or with more options (ref: https://lodash.com/docs/4.17.10#debounce)
+It uses [lodash's debounce](https://lodash.com/docs/4.17.10#debounce) function under the hood, so you get all the benefits of it out of the box like so!
```jsx
const SearchThis = props => (
@@ -348,11 +324,7 @@ const SearchThis = props => (
{data => (