Getting Started
Like any scala.js project to get started you need to include the libraries in your build. the artifacts are published to a bintray only and not jcenter or maven.
Then use the following imports to import functionality you need:
Implicits
Some extension methods a few implicit conversions are provided to make the facade more ergonomic.
Since this is a facade library that is designed to be integrated into other javascript/reason react applications, you will most likely need to use javascript objects on your imported objects as well as your exported components. Making js objects easy to use in scala is an importent design point.
The react.implicits._
imports the extensions.
Since implicit conversion can make your code base more complicated
when automatic conversions go awry, the syntax enhancements and conversions are
offered ala cart. However, you should use the general import react.implicits._
when first starting out. See the API docs for ala cart imports.
npm and js packages
Based on the scala libraries you use, you will need to bundle the appropriate
packages. All of the scala.js imports underneath in the interop layer convert to
CJS require
calls.
- core: react (>=16.8+)
- react-dom: react-dom (>=16.8+)
- prop-types: prop-types
- vdom: no js dependencies
- fabric: office-ui-fabric-react (>= 7.0), or merge-styles directly for only that
- redux: react-redux, redux
If you include these in your package.json as runtime dependencies you
should be all set. If you use scalajs-bundler
you would need to add these to
your build.sbt file.