Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. hyperapp1/index.html
  2.  
  3. <!doctype html>
  4. <html class="no-js" lang="">
  5. <head>
  6. <meta charset="utf-8">
  7. <meta http-equiv="x-ua-compatible" content="ie=edge">
  8. <title>Postix</title>
  9. <meta name="description" content="">
  10. <meta name="viewport" content="width=device-width, initial-scale=1">
  11. </head>
  12. <body>
  13. <script src="src/index.js"></script>
  14. </body>
  15. </html>
  16.  
  17. ----------------------------------------------.
  18.  
  19. hyperapp1/.babelrc
  20.  
  21. {
  22. "presets": ["env"],
  23.  
  24. "plugins": [["transform-react-jsx", { "pragma": "h" }]]
  25. }
  26.  
  27. ---------------------
  28. hyperapp1/src/index.js
  29.  
  30. import { Route, location } from "@hyperapp/router";
  31.  
  32. import Layout from "./components/Layout.js";
  33. import Home from "./pages/Home.js";
  34. import About from "./pages/About.js";
  35.  
  36. const state = {
  37. location: location.state
  38. };
  39.  
  40. const actions = {
  41. location: location.actions
  42. };
  43.  
  44. const view = () => h("div", {class:"main"}, [
  45. h(Route, { path: "/", render: () => Layout({}, Home) }),
  46. h(Route, { path: "/about", render: () => Layout({}, About) })
  47. ])
  48.  
  49. const main = logger()(app)(state, actions, view, document.body)
  50. const unsubscribe = location.subscribe(main.location);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement