/components

How to embed Elm in a bunch of different JS frameworks.

Primary LanguageJavaScriptBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Elm at Work

Would you like to try out Elm in an existing project? A full rewrite is too risky? Just embed a little Elm node and see how it goes. You can grow it or revert if depending on how it goes. No big deal either way!


Embed an Elm program

The following code shows how to embed an Elm program in some of the most popular JS frameworks. Just copy the relevant code into your project and go from there:

To edit these snippets, read the chapter on JavaScript interop in the official guide. It is easy to send messages back and forth between Elm and JavaScript, and the guide will give you the confidence to start trying that out.

For other JS frameworks, read the chapter on JavaScript interop in the official guide. There is nothing fancy in any of these snippets, and it should be easy to get going in whatever framework you happen to use.