react redux cheat sheet
// Dispatches an action; this changes the state
store.dispatch({ type: 'INCREMENT' })
store.dispatch({ type: 'DECREMENT' })
// Gets the current state
store.getState()
import { createStore } from 'redux'
// Optional - you can pass `initialState` as a second arg
let store = createStore(counter, { value: 0 })
// Reducer
function counter (state = { value: 0 }, action) {
switch (action.type) {
case 'INCREMENT':
return { value: state.value + 1 }
case 'DECREMENT':
return { value: state.value - 1 }
default:
return state
}
}
let store = createStore(counter)
Also in JavaScript:
- adding preview images to react apps for linkedin
- javascript email validation
- ctx.fillstyle
- setup material ui next js
- append string in variable using jquery in each loop
- Beginning Node.js
- pdf.js change background color
- javascript get first 2 char
- bullmq redis cluster
- price range slider bootstrap 4
- automatic compile nodejs when edit
- composer require friendsofcake/crud-json-api for cakephp3 version
- tab navigation react-native without title
- npm react router 6.0.0-alpha.2
- focus on input field vuejs event
- get random entry from array javascript
- map over object javascript
- js oneline foreach
- js style
- javascript remove last character of string
- set up background process in express app
- minecraft
- email collapsible section
- angular directive example