Slinky has a strong focus on mirroring the ES6 API. This means that any documentation or examples for ES6 React can be easily applied to your Scala code.
There are no new patterns involved with using Slinky. Just write React apps like you would in any other language!
Slinky provides straightforward APIs for using external components. Simply define the component's properties using standard Scala types and you're good to go!
In addition, Slinky components can be used from JavaScript code, thanks to a built in Scala to JS mappings. This means that your favorite libraries like React Router work out of the box with Slinky!
Writing web applications with Scala doesn't have to feel like a degraded development experience. Slinky comes ready with full integration with familiar tools like Webpack and React DevTools.
Slinky also comes with built-in support for hot-loading via Webpack, allowing you to make your code-test-repeat flow even faster!
Just like React, Slinky components implement a render()
method that returns what to display based on the input data, but also define a Props
type that defines the input data shape. Slinky comes with a tags API for constructing HTML trees that gives a similar experience to other Scala libraries like ScalaTags but also includes additional type-safety requirements. Input data that is passed into the component can be accessed by render()
via props
Slinky components, just like React components, can maintain internal state data (accessed with state
). When a component's state data changes after an invocation of setState
, the rendered markup will be update by re-invoking render()
.
Using props
and state
, we can put together a small Todo application. This example uses state to track the current list of items as well as the text that the user has entered.