Skip to content

Instantly share code, notes, and snippets.

@vedovelli
Created March 13, 2018 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vedovelli/2f6d56e18f7e0e916546710b1958ad24 to your computer and use it in GitHub Desktop.
Save vedovelli/2f6d56e18f7e0e916546710b1958ad24 to your computer and use it in GitHub Desktop.
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">&times;</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