-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rogerd Júnior Ribeiro Bitarães
committed
Jan 15, 2019
1 parent
258c098
commit b51c181
Showing
5 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from "react"; | ||
|
||
import { View, Text } from "react-native"; | ||
import { connect } from "react-redux"; | ||
|
||
const TodoList = ({ todos }) => ( | ||
<View> | ||
{todos.map(todo => ( | ||
<Text>{todo}</Text> | ||
))} | ||
</View> | ||
); | ||
|
||
const mapStateToProps = state => ({ | ||
todos: state.todos | ||
}); | ||
|
||
export default connect(mapStateToProps)(TodoList); |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { createStore } from "redux"; | ||
import reducers from "./reducers"; | ||
|
||
const store = createStore(() => {}); | ||
const store = createStore(reducers); | ||
|
||
export default store; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { combineReducers } from "redux"; | ||
|
||
import todos from "./todos"; | ||
export default combineReducers({ | ||
todos | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const INITIAL_STATE = ["fazer café", "estudar react native"]; | ||
|
||
export default function todos(state = INITIAL_STATE, action) { | ||
switch (action.type) { | ||
case "ADD_TODO": | ||
return [...state, action.text]; | ||
default: | ||
return state; | ||
} | ||
} |