Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Syamlal CM syamjayaraj

🎯
Focusing
Block or report user

Report or block syamjayaraj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Footer.jsx
View Navigation.jsx
import React from "react";
function Navigation(props) {
return (
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="#">
React Multi-Language Website
</a>
<div className="language-select">
View index.js
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>,
View index.js
import {applyMiddleware, createStore} from 'redux'
import logger from 'redux-logger'
import rootReducer from '../reducers'
const store = createStore(rootReducer, applyMiddleware(
logger
))
export default store
View counterReducer.js
const initialState = {
count: 0,
}
function CounterReducer (state = initialState, action){
switch(action.type){
case "INCREMENT_COUNT": {
return {...state, ...action}
}
case "DECREMENT_COUNT": {
View index.js
import {combineReducers} from 'redux'
import CounterReducer from '../reducers/CounterReducer'
export default combineReducers({
counter: CounterReducer,
})
View index.js
export const incrementCount = count => {
const num = count+1
return {
type: 'INCREMENT_COUNT',
count: num
}
}
export const decrementCount = count => {
const num = count - 1
View Button.js
import React from 'react'
const Button = (props) => {
return(
<div>
<button onClick = {props.action} >{props.buttonTitle}</button>
</div>
)
}
View CounterComponent.js
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)
}
View index.js
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>,
You can’t perform that action at this time.