This file contains hidden or 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> | |
<title>a simple elm counter</title> | |
</head> | |
<body> | |
<div id="counter"></div> | |
<script src="counter.js"></script> | |
<script> |
This file contains hidden or 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 Html.Events exposing (onClick) | |
-- other code | |
view state = | |
div [] | |
[ button [onClick Decrement] [ text "-" ] | |
, span [] [ text (toString state) ] | |
, button [onClick Increment] [ text "+" ] | |
] |
This file contains hidden or 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 Html.App as Html | |
main = | |
Html.beginnerProgram { model = 0, view = view, update = update } | |
view state = | |
div [] | |
[ button [] [ text "-" ] |
This file contains hidden or 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
type Action | |
= Increment | |
| Decrement |
This file contains hidden or 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
module Main exposing (..) | |
import Html exposing (button, div, span, text) | |
+ import Html.App as Html | |
main = | |
+ view | |
+ | |
+ view = |
This file contains hidden or 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
module Counter exposing (..) | |
import Html exposing (button, div, span, text) | |
main = | |
div [] | |
[ button [] [ text "-" ] | |
, span [] [ text "0" ] | |
, button [] [ text "+" ] |
This file contains hidden or 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
module Counter exposing (..) | |
import Html exposing (button, div, span, text) | |
import Html.App as Html | |
import Html.Events exposing (onClick) | |
main = | |
Html.beginnerProgram { model = 0, view = view, update = update } |
This file contains hidden or 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
Show hidden characters
{ | |
"presets": [ | |
"es2015", | |
"react" | |
] | |
} |
This file contains hidden or 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
module.exports = { | |
entry: './app.js', | |
output: { | |
path: './', | |
filename: 'bundle.js' | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.js$/, |
This file contains hidden or 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
{ | |
"name": "react-redux-counter", | |
"version": "1.0.0", | |
"description": "A simple counter in react+redux", | |
"dependencies": { | |
"react": "^15.0.2", | |
"react-dom": "^15.0.2", | |
"redux": "^3.5.2" | |
}, | |
"devDependencies": { |
NewerOlder