0.0.30 • Published 5 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
5 years ago
0.0.29
5 years ago
0.0.28
5 years ago
0.0.27
5 years ago
0.0.26
5 years ago
0.0.25
5 years ago
0.0.24
5 years ago
0.0.23
5 years ago
0.0.22
5 years ago
0.0.20
5 years ago
0.0.19
5 years ago
0.0.18
5 years ago
0.0.17
5 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
6 years ago
0.0.7
6 years ago
0.0.6
6 years ago
0.0.5
6 years ago
0.0.4
6 years ago
0.0.3
6 years ago
0.0.1
6 years ago