Skip to content

Commit ebc3252

Browse files
author
Matthieu Napoli
committed
Rename the errorMessage variable to avoid name collisions
1 parent 89bb3d4 commit ebc3252

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

App/Containers/HomeScreen.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class HomeScreen extends React.Component {
2525
The weather temperature is: {this.props.temperature}
2626
</Text>
2727
<Text style={styles.instructions}>{this.props.isHot ? "It's pretty hot!" : ''}</Text>
28-
<Text style={styles.instructions}>{this.props.errorMessage}</Text>
28+
<Text style={styles.instructions}>{this.props.temperatureErrorMessage}</Text>
2929
<Button onPress={this.props.fetchTemperature} title="Refresh" />
3030
</View>
3131
)
@@ -51,12 +51,12 @@ const styles = StyleSheet.create({
5151

5252
HomeScreen.propsTypes = {
5353
temperature: PropTypes.number,
54-
errorMessage: PropTypes.string,
54+
temperatureErrorMessage: PropTypes.string,
5555
}
5656

5757
const mapStateToProps = (state) => ({
5858
temperature: state.example.get('temperature'),
59-
errorMessage: state.example.get('errorMessage'),
59+
temperatureErrorMessage: state.example.get('temperatureErrorMessage'),
6060
isHot: isHot(state),
6161
})
6262

App/Stores/Example/InitialState.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ import { Map } from 'immutable'
55
*/
66
export const INITIAL_STATE = Map({
77
temperature: null,
8-
errorMessage: null,
8+
temperatureErrorMessage: null,
99
})

App/Stores/Example/Reducers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ import { ExampleTypes } from './Actions'
88
export const updateTemperature = (state, { temperature }) =>
99
state.merge({
1010
temperature: temperature,
11-
errorMessage: null,
11+
temperatureErrorMessage: null,
1212
})
1313

1414
/**
15-
* Example of a reducer that updates the `errorMessage` property.
15+
* Example of a reducer that updates the `temperatureErrorMessage` property.
1616
*/
1717
export const showErrorMessage = (state, { errorMessage }) =>
1818
state.merge({
1919
temperature: '??',
20-
errorMessage: errorMessage,
20+
temperatureErrorMessage: errorMessage,
2121
})
2222

2323
/**

0 commit comments

Comments
 (0)