Hello World

by mithril

Level: beginner • Mithril.js Version: latest

This example shows the classic Hello World in Mithril.js. The example was taken from the official website at https://mithril.js.org/index.html#hello-world."

Live Example

Dependencies

Type Name URL
scriptmithril@latesthttps://unpkg.com/mithril@latest

HTML

<!doctype html>
<html lang=en>
<head>
  <meta charset=utf-8>
  <title>Hello World</title>
</head>
<body>
</body>
</html>

JavaScript

m.render(document.body, "Hello World")

As a prerequisite for this snippet, the latest version of Mithril.js framework is required. Beginners should have no problems following this example, that simply shows some basic recipies.

In this code sample Mithril.js' m.render API method is use, besides the basic hyperscript function m().

The example was written by mithril, last edits were made on 16 October 2021. The author has contributed some more snippets. Click here to see them all.

Contribute

Did you note a typo or something else? So let me know by opening an issue. Or much better: just fork the repository on GitHub, push your commits and send a pull request. Ready to start your work? Then click on the edit link below. Thanks in advance!

See more code examples  •  Edit this example on GitHub