Skip to content

Instantly share code, notes, and snippets.

View syamjayaraj's full-sized avatar
🎯
Focusing

Syamlal CM syamjayaraj

🎯
Focusing
View GitHub Profile
_toggleDonorPost(){
this.setState({
isSubmited: false
})
}
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>
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>,
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)
}
import React from 'react'
const Button = (props) => {
return(
<div>
<button onClick = {props.action} >{props.buttonTitle}</button>
</div>
)
}
export const incrementCount = count => {
const num = count+1
return {
type: 'INCREMENT_COUNT',
count: num
}
}
export const decrementCount = count => {
const num = count - 1
import {combineReducers} from 'redux'
import CounterReducer from '../reducers/CounterReducer'
export default combineReducers({
counter: CounterReducer,
})
const initialState = {
count: 0,
}
function CounterReducer (state = initialState, action){
switch(action.type){
case "INCREMENT_COUNT": {
return {...state, ...action}
}
case "DECREMENT_COUNT": {
import {applyMiddleware, createStore} from 'redux'
import logger from 'redux-logger'
import rootReducer from '../reducers'
const store = createStore(rootReducer, applyMiddleware(
logger
))
export default store
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>,