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
1
vote
2 answers

Wrapping/facading a ScalaJS react js component (react-sticky) in the most encapsulating manner possible

I have seen several methods of making a facade or wrapping Javascript components in scala.js, including doing so for react.js Components. They seem to vary in the degree they encapsulate or hide the functionality provided by the component itself, I…
tacos_tacos_tacos
  • 10,277
  • 11
  • 73
  • 126
1
vote
1 answer

Data model structure using autowire

what is the best approach to structure data model when using autowire? here is basic use case: i have domain data model on the backend which has case class User with fields id, username, active, auth_token which represents. This class maps to sql…
andresrcom
  • 23
  • 4
1
vote
1 answer

ScalaJS React onClick handler using router for the wrapped component

I'm wrapping Bootstrap React for use in the Japgolly ScalaJS React and have come up with the following: case class NavItem( onClick: UndefOr[js.Function1[ReactEvent, Boolean]] = undefined, // ... ) { /* ... create method here */ } object…
John M
  • 1,469
  • 17
  • 41
1
vote
1 answer

How to get Ref to component in scalsjs-react?

This doc https://github.com/japgolly/scalajs-react/blob/master/doc/USAGE.md#refs is a bit unclear. I've created small example: "squareViewer" showes "square" by click How can I get Ref to component "square" in method…
1
vote
1 answer

Setting state in ajax success in scalajs-react

I am trying to open one popup on successful submission of another in scalajs-react. My problem is on success state is not getting modified. Here is my addNewAgent method called as a callback on submission of first popup. def addNewAgent(userModel:…
user4833870
1
vote
1 answer

How to married scalajs-react and autowire on a client side?

I have trouble to mix autowire calls with scalajs-react components. Here is a simple example using scalajs-react v0.10.0 + autowire v0.2.5 case class User(name: String) class Backend($: BackendScope[Unit, User]) { def mounted: Callback = { …
falcon
  • 372
  • 3
  • 19
1
vote
1 answer

scalajs-react migration from 0.8.1 to 0.9.2

Basically, I'm searching for useful react-bootstrap wrapper. During reviewing different possibilities i've found this github project. I've forked them and start updating versions. But after updating scalajs-react version from 0.8.1 to 0.9.2 i've…
falcon
  • 372
  • 3
  • 19
1
vote
2 answers

How to handle large js files in a Scala.js React.js application?

How do we handle app-jsdeps.js and app-opt.js in a large Scala.js React applications with a lot of js code & dependencies ? I've build my first web application using @japgolly scalajs-react using @ochrons spa-tutorial example but even after…
user794783
  • 3,619
  • 7
  • 36
  • 58
1
vote
0 answers

scalajs-react ComponentScope unification

I have some state-modifying tasks needed to be run inside componentDidMount as well inside button click handlers defined in renderS method. Tasks have a lot of common code so i've decided to join them inside one class, that receives scope and…
Odomontois
  • 15,918
  • 2
  • 36
  • 71
0
votes
1 answer

scalajs-react: sending child component currrent state of information

I have a child component sitting inside a parent component. Parent component has some information, say I, which keeps changing based on user actions. In child component I have a button, and I want to change state of this button based on current…
Mandroid
  • 6,200
  • 12
  • 64
  • 134
0
votes
1 answer

Radiobutton click event invoking callback 2 times

I have a radio button defined as: <.label( ....styling ^.onClick ==> { event => event.stopPropagation() props.select }, <.input.radio( ....styling ^.onChange ==> { event => …
Mandroid
  • 6,200
  • 12
  • 64
  • 134
0
votes
1 answer

scalajs-react: Idiomatic way of processing ajax response

I am sending a GET request to backend rest service, as follows: def showAllEmployees = Callback { org.scalajs.dom.ext.Ajax.get(url = "http://localhost:8081/fetchAllEmployees").onComplete { case Success(xhr) => { …
Mandroid
  • 6,200
  • 12
  • 64
  • 134
0
votes
1 answer

scalajs-react: How to have multiline text field from a Seq in state object?

I am working in a scalajs-react application. One of the UI field I have is an input field for multiline text, and it is mapped to a property of state object. State object definition: case class Person(name: String, addresses: Seq[String]) I have…
Mandroid
  • 6,200
  • 12
  • 64
  • 134
0
votes
1 answer

Scalajs-react: How to invoke a custom method on button click?

I am trying to build a HTML page for my simple application using scalajs-react, and here is my effort: <.div( <.p("Welcome to foodland!"), <.form( <.label("Name of the recipe:", <.input.text(^.name :=…
Mandroid
  • 6,200
  • 12
  • 64
  • 134
0
votes
1 answer

How to upload a file with scalajs-react and AJAX

I want to send a file with Scalajs-react and Ajax. The sending part is easy with Ajax.send(requestBody: js.Any) method in the onSubmit method of my form (which I took care to stop the event propagation with preventDefault). To build the request…
stackoverflowed
  • 686
  • 8
  • 22