0.0.30 • Published 6 years ago
redux-clue v0.0.30
redux-clue
import ReduxClue, { Clue, queries } from 'redux-clue'
const clue = ReduxClue({
storeKey: 'clue',
apiPrefix: 'api',
apiPluralize: false,
models: ['product']
});
const propsToProductClue = props => ({ identity: 'product', query: queries.FIND_ONE, id: props.productId });
const productSelector = clue.selectors.byClue(propsToProductClue);
@connect(
(state, props) => ({
product: productSelector(state, props)
}),
{ requestProduct: clue.actions.byClue }
)
class Component extends React.Component {
componentDidMount() {
this.props.requestProduct(propsToProductClue(this.props));
},
render() {
return <div>
{ this.props.product && this.props.product.pending && "Loading..." }
{ this.props.product && this.props.product.error && "An error occured!" }
{ this.props.product && this.props.product.data && JSON.stringify(this.props.product.data) }
<p>
{ JSON.stringify(this.props.product) }
</p>
</div>;
}
}
0.0.30
6 years ago
0.0.29
6 years ago
0.0.28
6 years ago
0.0.27
6 years ago
0.0.26
6 years ago
0.0.25
6 years ago
0.0.24
6 years ago
0.0.23
6 years ago
0.0.22
6 years ago
0.0.20
6 years ago
0.0.19
6 years ago
0.0.18
6 years ago
0.0.17
6 years ago
0.0.16
6 years ago
0.0.15
6 years ago
0.0.14
6 years ago
0.0.13
6 years ago
0.0.12
6 years ago
0.0.11
6 years ago
0.0.10
6 years ago
0.0.9
6 years ago
0.0.8
7 years ago
0.0.7
7 years ago
0.0.6
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.1
7 years ago