Interact with JavaScript

Elm provides many built-in as well as third-party packages for solving various problems that arise as we build client-side web applications. Even though Elm’s package catalog keeps growing, there are times when we need to rely on a JavaScript package to get things done.

Ideally, we should avoid using JavaScript packages in our Elm code base because they can cause runtime errors. Unfortunately, it’ll take a long time for Elm to catch up to the JavaScript ecosystem which has tens of thousands of packages for solving a wide variety of problems. Therefore, it’s important for us to know how to interact with JavaScript code from Elm.

In this chapter, we’ll learn how to use ports and flags to safely communicate with JavaScript. We’ll also learn how to take advantage of custom elements built using Web Components.

New chapters are coming soon!

Sign up for the Elm Programming newsletter to get notified!

* indicates required