![]() When you’re finished, you should see a result like the following in your browser: In this short tutorial I’ll demonstrate how to create a Slinky “Hello, world” example. Just write React apps like you would in any other language!” This means that any documentation or examples for ES6 React can be easily applied to your Scala code. ![]() From its documentation, “Slinky has a strong focus on mirroring the ES6 API. Slinky is a library that’s build on top of Scala.js, and it mimics the React.js platform.When you do so, the resulting JavaScript code prints “Hello, world” to your browser console. You can compile that class to a JavaScript file with a sbt/Scala.js command, and then include that file in an HTML document. For instance, when you write a Scala class like this: Combined with the sbt build tool, Scala.js lets you write Scala code that can be compile/transpiled to JavaScript.(Scala 3 was just released, but I wanted to keep this tutorial as simple as possible.) In regards to the first steps of this tutorial, if you’re already comfortable with Scala, sbt, and Scala.js, and just want to learn how to use Slinky, skip the next section and go on to the “Getting started” section. If you’re comfortable with Scala 2, sbt, HTML, JavaScript, and Facebook’s React library, you should be able to understand this tutorial. In this article I share a Slinky “Hello, world” tutorial, using sbt as the build tool. When I did that, I began to look at these Scala.js libraries:Īs I tried to work with those libraries, I coudn’t find any simple “Hello, world” examples for any of them, so as a result I’ve started to create those myself. ![]() par, and performanceĪs I was writing the Scala Cookbook, 2nd Edition - and debating writing a book about Scala.js - I had to start thinking about how to implement Scala.js applications in the real world. show more info on classes/objects in repl.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |