react-redux-alerts
Advanced tools
Comparing version 1.3.6 to 1.3.7
@@ -65,7 +65,8 @@ 'use strict'; | ||
var mapStateToProps = function mapStateToProps(state) { | ||
isVisible: state.alerts ? state.alerts[alertName] : false; | ||
function mapStateToProps(state) { | ||
return { isVisible: state.alerts ? state.alerts[alertName] : false }; | ||
}; | ||
var mapDispatchToProps = function mapDispatchToProps(dispatch) { | ||
actions: (0, _redux.bindActionCreators)(alertActions, dispatch); | ||
function mapDispatchToProps(dispatch) { | ||
return { actions: (0, _redux.bindActionCreators)(alertActions, dispatch) }; | ||
}; | ||
@@ -72,0 +73,0 @@ return (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(AlertContainer); |
@@ -38,2 +38,3 @@ 'use strict'; | ||
if (state === undefined) return state; | ||
if (type === alertTypes.INITIALIZE_ALERT) { | ||
@@ -48,2 +49,3 @@ return _extends({}, state, _defineProperty({}, alertName, false)); | ||
} | ||
if (state[alertName] === undefined) return state; | ||
@@ -50,0 +52,0 @@ if (type === alertTypes.DESTROY_ALERT) { |
{ | ||
"name": "react-redux-alerts", | ||
"version": "1.3.6", | ||
"version": "1.3.7", | ||
"description": "A lightweight library for creating keyed alerts in a Redux app", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -25,7 +25,13 @@ import React, { Component } from 'react'; | ||
const mapStateToProps = state => { isVisible: state.alerts ? state.alerts[alertName] : false }; | ||
const mapDispatchToProps = dispatch => { actions: bindActionCreators(alertActions, dispatch) }; | ||
function mapStateToProps (state) { | ||
return { isVisible: state.alerts ? state.alerts[alertName] : false }; | ||
}; | ||
function mapDispatchToProps (dispatch) { | ||
return { actions: bindActionCreators(alertActions, dispatch) }; | ||
}; | ||
return connect(mapStateToProps, mapDispatchToProps)(AlertContainer); | ||
}; | ||
export default createAlert; |
@@ -22,2 +22,3 @@ import * as alertTypes from './constants'; | ||
const {type, alertName } = action; | ||
if (state === undefined) return state; | ||
if (type === alertTypes.INITIALIZE_ALERT) { | ||
@@ -36,2 +37,3 @@ return { | ||
} | ||
if (state[alertName] === undefined) return state; | ||
@@ -38,0 +40,0 @@ if (type === alertTypes.DESTROY_ALERT) { |
17978
407