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 { COUNTER_ADD, COUNTER_SUBTRACT } from "../actions/action_types"; | |
| const initialState = { | |
| count: 0 | |
| }; | |
| const counterReducer = (state = initialState, action) => { | |
| switch (action.type) { | |
| case COUNTER_ADD: | |
| return { |
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 { createStore, combineReducers, compose } from 'redux'; | |
| import counterReducer from './reducers/counter_reducer'; | |
| const rootReducer = combineReducers({ | |
| counter: counterReducer, | |
| }); | |
| let composeEnhancers = compose; | |
| if(__DEV__){ |
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 { createStore, combineReducers } from 'redux'; | |
| import counterReducer from './reducers/counter_reducer'; | |
| const rootReducer = combineReducers({ | |
| counter: counterReducer, | |
| }); | |
| const configStore = () => { | |
| return createStore(rootReducer); | |
| }; |
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'; // Remember to import React | |
| import { AppRegistry } from 'react-native'; | |
| import { Provider } from 'react-redux'; | |
| import {name as appname} from './app.json'; | |
| import Application from './src/app'; | |
| import configStore from './src/store/config_store'; | |
| const store = configStore(); |
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
| export const COUNTER_ADD = 'COUNTER_ADD'; | |
| export const COUNTER_SUBTRACT = 'COUNTER_SUBTRACT'; |
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 { COUNTER_ADD, COUNTER_SUBTRACT } from "./action_types"; | |
| export const counterAdd = () => { | |
| return { | |
| type: COUNTER_ADD | |
| }; | |
| } | |
| export const counterSubtract = () => { | |
| return { |
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
| export { counterAdd, counterSubtract } from './counter_actions'; |
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, { Component } from "react"; | |
| import { View, Text, StyleSheet } from "react-native"; | |
| import { connect } from "react-redux"; | |
| class CounterComponent extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = {}; | |
| } |
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, { Component } from 'react'; | |
| import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'; | |
| import { connect } from 'react-redux'; | |
| import { counterAdd, counterSubtract } from '../store/actions/index'; | |
| import CounterComponent from '../components/counter'; | |
| class MainScreen extends Component { |
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
| src | |
| |_components | |
| | |_counter.js | |
| | | |
| |_screens | |
| | |_main_screen.js | |
| | | |
| |_store | |
| |_actions | |
| | |_action_types.js |
OlderNewer