-
-
Save myguidingstar-zz/bfd0d94f9b1541b944667b0f7cfc46f7 to your computer and use it in GitHub Desktop.
Use Rum with Javeline
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
[hoplon/javelin "3.8.4"] | |
[rum "0.9.1"] |
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>Some app</title> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<div id="app"></div> | |
</body> | |
<script type="text/javascript" src="main.js"></script> | |
</html> |
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
(ns some.app | |
(:require [rum.core :as rum] | |
[javelin.core :refer-macros [defc defc=]])) | |
(defc a 0) | |
(defc b 10) | |
(defc= c (* a b)) | |
(rum/defc body < rum/reactive | |
[] | |
[:div | |
[:input {:type "range" | |
:min -5 :max 5 | |
:on-change #(reset! a (.. % -target -value)) | |
:value (rum/react a)}] | |
[:br] | |
[:input {:type "range" | |
:min -5 :max 5 | |
:on-change #(reset! b (.. % -target -value)) | |
:value (rum/react b)}] | |
[:p (str (rum/react a) " × " (rum/react b) | |
" = " (rum/react c))]]) | |
(defn main [] | |
(rum/mount (body) (.getElementById js/document "app"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment