Questions tagged [scalajs-react]

scalajs-react lifts Facebook's React library into Scala.js and endeavours to make it as type-safe and Scala-friendly as possible.

scalajs-react is a Scala.js library to levarage Facebook's React in Scala.js code. Is contains facade types for React and a Scala-friendly adapter around the virtual DOM.

https://japgolly.github.io/scalajs-react/

76 questions
0
votes
1 answer

ScalaJSReact Uncaught referenceError in React.scala

I'm trying out scalajsReact with this hello world example: object ScalaJSExample { def main(args: Array[String]): Unit = { val NoArgs = ScalaComponent.static(<.div("Hello!")) NoArgs().renderIntoDOM(document.body) } But I get this…
stackoverflowed
  • 686
  • 8
  • 22
0
votes
1 answer

how to create a scala sbt project model which represents a model to other sbt projects?

i have a scala js sbt project, i developped in this project new user interface components. the person p1 has a project with the same structure (same build.properties & plugins.sbt), how can he access to my user interface components. Should i add…
0
votes
1 answer

How to get element after "onClick"

I use scalajs-react and cannot understand why it does not work please help, it seems to be easy <.dev()(^.onClick ==> {(e: ReactEventFromHtml) => handler(e)}) def handler(e: ReactEventFromHtml): Callback = { Callback { val elem = e.target …
George
  • 53
  • 5
0
votes
1 answer

Is there a way of rendering a TagMod in a component

Say I have a table defined as follows: val cols = Seq("One", "Two", "Three") <.table( <.tbody( <.tr( rows.map(r => <.td(r)).toTagMod ) ) ) And I want to wrap each row part in a…
user79074
  • 4,937
  • 5
  • 29
  • 57
0
votes
1 answer

React Simple Global Entity Cache instead of Flux/React/etc

I am writing a little "fun" Scala/Scala.js project. On my server I have Entities which are referenced by uuid-s (inside Ref-s). For the sake of "fun", I don't want to use flux/redux architecture but still use React on the client (with…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
0
votes
1 answer

scalajs-react router. How to perform ajax request inside conditional route

I am trying to make some conditional routes. The condition resolves on the serverside. Route rule example: | (dynamicRouteCT("#user" / long.caseClass[User]) ~> dynRender((page: User) => <.div("Hello, " + page.id.toString))) .addCondition((page:…
Oleg
  • 899
  • 1
  • 8
  • 22
0
votes
1 answer

ComponentDidMount actions with timeout

I am trying to perform some actions when my component did mount, but not immediately. My component looks like something this: object MyComponent { def apply = compopnent() class Backend($: BackendScope) { def render = { // Some…
Oleg
  • 899
  • 1
  • 8
  • 22
0
votes
1 answer

Some references to JS libraries could not be resolved

I am trying to follow the ScalaJS Book tutorial. Based on their build.sbt sample here https://github.com/ochrons/scalajs-spa-tutorial/blob/master/build.sbt I have created the following build.sbt lazy val client = (project in file("client")) …
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
0
votes
1 answer

Use StateSnapshots with a Backend in scalajs-react

The main component in the StateSnapshot example does not use a backend, but I need one. My try: class MainBackend($ : BackendScope[Unit, Name]) { def render(name: Name) = { val firstNameV = StateSnapshot.zoomL(Name.firstName).of(name) val…
Tamriel
  • 1,337
  • 1
  • 9
  • 9
0
votes
1 answer

Don't re-render siblings in Treeview with scalajs-react

I've built a simple TreeView with scalajs-react. Each node contains a text field. I write some text into child 1.1: Now, if I add new child 1.2 below 1, the text disappears because node 1 with all its children gets re-rendered: When adding a…
Tamriel
  • 1,337
  • 1
  • 9
  • 9
0
votes
1 answer

Vertx Eventbus client with Scala.js

I'm trying to create a new Vertx Eventbus instance in Scala.js project. No matter what I do, I get INVALID_STATE_ERR when trying to register handler in onopen function. It seems like the onopen is being fired prematurely. Example…
Anton
  • 103
  • 1
0
votes
1 answer

How to import Scalajs Facade with react-native? Error: $g.algoliasearch is not a function

I want to use facade Algoliasearch in my scalajs app, I imported it through sbt and but on UI I see $g.algoliasearch is not a function. I assume this is because of missing javascript libraries. I have included Algoliaseach-client-javascript…
0
votes
1 answer

When is using runNow() allowed in scalajs-react and why?

The runNow method here has the documentation: /** * Executes this callback, on the current thread, right now, blocking until complete. * * In most cases, this type is passed to scalajs-react such that you don't need to call this method…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
0
votes
1 answer

How should children nodes be passed to a ReactComponent

I've been using scalajs-react for a couple of weeks and so far I've never used the "children" parameter of ReactComponentC.apply() because my children ReactNodes are usually conditionally defined in c.backend.render(). Am I doing something wrong? I…
stackoverflowed
  • 686
  • 8
  • 22
0
votes
1 answer

ScalaJS with React: can't find React at runtime

I want to bootstrap a simple project with ScalaJS and React. It builds with fastOptJS, then I open my index.html with Chrome and I get this error at runtime: Apparently, React's runtime is not available in the browser. In the documentation it…
pietro909
  • 1,811
  • 1
  • 19
  • 26