An open API service indexing awesome lists of open source software.

https://github.com/nsaunders/react-router-promises

Adapts react-router hooks to promises instead of callbacks.
https://github.com/nsaunders/react-router-promises

Last synced: about 2 months ago
JSON representation

Adapts react-router hooks to promises instead of callbacks.

Awesome Lists containing this project

README

          

# react-router-promises
Adapts react-router hooks to promises instead of callbacks.

Instead of this:
```
function loadUsersIntoStore(nextState) {
return new Promise((resolve, reject) => {
// fetch user listing and add it to the data store
});
}

function loadUsersOnEnter(nextState, replace, callback) {
loadUsersIntoStore(nextState).then(callback);
}

function loadUsersOnChange(prevState, nextState, replace, callback) {
loadUsersIntoStore(nextState).then(callback);
}
```
```

```

This library will allow you to do this:
```
import { enter, change } from 'react-router-promises';

function loadUsersIntoStore(nextState) {
return new Promise((resolve, reject) => {
// fetch user listing and add it to the data store
});
}
```
```

```