Skip to content

Instantly share code, notes, and snippets.

@PolGuixe
Created July 1, 2016 10:26
Show Gist options
  • Save PolGuixe/42c572704986b79ea3ce2a8f80ad2409 to your computer and use it in GitHub Desktop.
Save PolGuixe/42c572704986b79ea3ce2a8f80ad2409 to your computer and use it in GitHub Desktop.
Add a way to set default loading and error components #8
// inside client/modules/core/configs/index.js
import reactKomposerConfig from './react-komposer-config';
export default function (context) {
reactKomposerConfig();
}
// inside client/modules/core/index.js
import actions from './actions';
import routes from './routes.jsx';
import configs from './configs';
export default {
routes,
actions,
load(context) {
configs(context);
}
};
// inside client/modules/core/configs/react-komposer-configs.js
import {setDefaultErrorComponent, setDefaultLoadingComponent} from 'react-komposer';
const ErrorComponent = () => (
<div>My Error</div>
);
const LoadingComponent = () => (
<div>My Loading</div>
);
export default function() {
setDefaultErrorComponent(ErrorComponent);
setDefaultLoadingComponent(LoadingComponent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment