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

https://github.com/caseywebdev/pave-react

A React Component to help with common Pave patterns.
https://github.com/caseywebdev/pave-react

Last synced: over 1 year ago
JSON representation

A React Component to help with common Pave patterns.

Awesome Lists containing this project

README

          

# PaveReact

A higher-order React component (HoC) to help with common Pave patterns.

## Install

```bash
npm install pave-react
```

## Usage

```
import {render} from 'react-dom';
import {withPave} from 'pave-react';
import store from './my-pave-store';

const User = withPave(
({pave: {isLoading, state: {user}}}) =>


{isLoading ? 'Loading...' : null}
{user ? `Hello ${user.name}!` : null}
,
{
getState: ({props: {userId}, store}) => ({
$query: ['usersById', userId],
user: store.get(['usersById', userId])
})
}
);

render(, document.body);
```