1.13.1 • Published 7 years ago
brandibble-redux v1.13.1
Brandibble Redux
A set of actions, reducers, and redux middleware for Brandibble.
Configuration
Middleware
import { brandibbleMiddleware } from 'brandibble-redux';
import { createStore, applyMiddleware, compose } from 'redux';
const store = createStore(
...
compose(
applyMiddleware(...brandibbleMiddleware),
)
...
);
Actions
import { fetchAllergens } from 'brandibble-redux';
...
dispatch(fetchAllergens(brandibble));
...
Reducers
import { reducer as brandibbleReducer } from 'brandibble-redux';
import { combineReducers } from 'redux';
export default combineReducers({
...
brandibble: brandibbleReducer,
...
});
Example
import App from './components/App';
import LoadingState from './components/LoadingState';
import {
Brandibble,
setupBrandibbleRedux,
} from 'brandibble-redux';
import { connect } from 'redux';
import { Component } from 'react'; // or 'react-native'
const brandibble = new Brandibble({
// ...config
});
const mapStateToProps = state => {
const { setupBrandibbleRedux } = state.brandibble.status;
return {
loaded: setupBrandibbleRedux === 'FULFILLED',
};
};
const mapDispatchToProps = dispatch => {
setup: () => dispatch(setupBrandibbleRedux(brandibble)),
};
@connect(mapStateToProps, mapDispatchToProps)
export default class Main extends Component {
componentWillMount() {
setup();
}
render() {
const { loaded } = this.props;
return loaded ? <LoadingState /> : <App />;
}
}
Working on Brandibble Redux
IMPORTANT: Set an environment variable called BRANDIBBLE_API_KEY
with your Brandibble API key before running tests.
git clone https://github.com/sanctuarycomputer/brandibble-redux
cd brandibble-redux
npm install
// Run tests (in chrome) with:
npm test
1.13.1
7 years ago
1.13.0
7 years ago
1.12.11
7 years ago
1.12.10
7 years ago
1.12.9
7 years ago
1.12.8
7 years ago
1.12.7
7 years ago
1.12.6
7 years ago
1.12.5
7 years ago
1.12.4
7 years ago
1.12.3
7 years ago
1.12.2
7 years ago
1.12.1
7 years ago
1.12.0
7 years ago
1.11.1
7 years ago
1.11.0
7 years ago
1.10.0
7 years ago
1.9.0
7 years ago
1.8.1
7 years ago
1.8.0
7 years ago
1.7.2
7 years ago
1.7.1
7 years ago
1.7.0
7 years ago
1.6.1
7 years ago
1.6.0
7 years ago
1.5.11
7 years ago
1.5.10
7 years ago
1.5.9
7 years ago
1.5.8
7 years ago
1.5.7
7 years ago
1.5.6
7 years ago
1.5.5
7 years ago
1.5.4
7 years ago
1.5.3
7 years ago
1.5.2
7 years ago
1.5.1
7 years ago
1.5.0
7 years ago
1.4.1
7 years ago
1.4.0
7 years ago
1.3.0
7 years ago
1.2.0
7 years ago
1.1.1
7 years ago
1.1.0
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago