Created
March 13, 2018 20:23
-
-
Save vedovelli/2f6d56e18f7e0e916546710b1958ad24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import actions from '../store/actions' | |
import { connect } from 'redux-zero/react' | |
import PropTypes from 'prop-types' | |
require('./App.scss') // eslint-disable-line no-undef | |
const App = ({ error, children, resetError }) => ( | |
<div> | |
{ | |
error && | |
<div className="alert alert-danger"> | |
<button onClick={resetError} type="button" className="close" aria-label="Close"> | |
<span aria-hidden="true">×</span> | |
</button> | |
An error occurred! | |
</div> | |
} | |
{children} | |
</div> | |
) | |
App.defaultProps = { | |
error: {} | |
} | |
App.propTypes = { | |
error: PropTypes.object, | |
children: PropTypes.object, | |
resetError: PropTypes.function | |
} | |
const mapToProps = ({ error }) => ({ error }) | |
export default connect(mapToProps, actions)(App) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment