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.
- Host: GitHub
- URL: https://github.com/caseywebdev/pave-react
- Owner: caseywebdev
- License: mit
- Created: 2016-02-16T02:27:45.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-10-10T17:53:52.000Z (over 8 years ago)
- Last Synced: 2025-03-06T04:41:35.538Z (over 1 year ago)
- Language: JavaScript
- Size: 44.9 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
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);
```