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
_toggleDonorPost(){ | |
this.setState({ | |
isSubmited: false | |
}) | |
} |
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
render() { | |
return ( | |
<Container> | |
<Header androidStatusBarColor="#af1313" style={{ backgroundColor: '#d11919' }}> | |
<Body style = {{ flex: 1, flexDirection: 'column', justifyContent: 'center', alignItems: 'center', }}> | |
<Title>BLOOD DONORS</Title> | |
</Body> | |
</Header> |
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
import React from 'react' | |
import { render } from 'react-dom' | |
import { Provider } from 'react-redux' | |
import CounterComponent from './containers/CounterComponent' | |
import store from './store' | |
render( | |
<Provider store={store}> | |
<CounterComponent /> | |
</Provider>, |
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
import React, {Component} from 'react' | |
import Button from '../components/Button' | |
import {connect} from 'react-redux' | |
import {incrementCount, decrementCount} from '../actions/index' | |
class CounterComponent extends Component{ | |
handleBtnActionIncrement = () => { | |
this.props.onIncrementClick(this.props.count) | |
} |
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
export const incrementCount = count => { | |
const num = count+1 | |
return { | |
type: 'INCREMENT_COUNT', | |
count: num | |
} | |
} | |
export const decrementCount = count => { | |
const num = count - 1 |
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
const initialState = { | |
count: 0, | |
} | |
function CounterReducer (state = initialState, action){ | |
switch(action.type){ | |
case "INCREMENT_COUNT": { | |
return {...state, ...action} | |
} | |
case "DECREMENT_COUNT": { |
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
import {combineReducers} from 'redux' | |
import CounterReducer from '../reducers/CounterReducer' | |
export default combineReducers({ | |
counter: CounterReducer, | |
}) |
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
import {applyMiddleware, createStore} from 'redux' | |
import logger from 'redux-logger' | |
import rootReducer from '../reducers' | |
const store = createStore(rootReducer, applyMiddleware( | |
logger | |
)) | |
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
import React from 'react' | |
import { render } from 'react-dom' | |
import { Provider } from 'react-redux' | |
import CounterComponent from './containers/CounterComponent' | |
import store from './store' | |
render( | |
<Provider store={store}> | |
<CounterComponent /> | |
</Provider>, |