Created
May 26, 2018 11:27
-
-
Save AmitKKhanchandani/fd259451541c6fc85ff6c1aaaf729757 to your computer and use it in GitHub Desktop.
JS Bin redux counter example // source https://jsbin.com/gugexik
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="redux counter example"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://fb.me/react-15.1.0.js"></script> | |
<script src="https://fb.me/react-dom-15.1.0.js"></script> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script id="jsbin-javascript"> | |
'use strict'; | |
var counter = function counter(state, action) { | |
if (state === undefined) state = 0; | |
switch (action.type) { | |
case 'Increment': | |
return state + 1; | |
case 'Decrement': | |
return state - 1; | |
default: | |
return state; | |
} | |
}; | |
var _Redux = Redux; | |
var createStore = _Redux.createStore; | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">const counter = (state =0, action) =>{ | |
switch(action.type){ | |
case 'Increment' : | |
return state + 1; | |
case 'Decrement' : | |
return state - 1; | |
default: | |
return state; | |
} | |
} | |
const {createStore} = Redux;</script></body> | |
</html> |
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
'use strict'; | |
var counter = function counter(state, action) { | |
if (state === undefined) state = 0; | |
switch (action.type) { | |
case 'Increment': | |
return state + 1; | |
case 'Decrement': | |
return state - 1; | |
default: | |
return state; | |
} | |
}; | |
var _Redux = Redux; | |
var createStore = _Redux.createStore; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment