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
77
questions
0
votes
1
answer
29
views
Hot Reloading Scala.js
How to hot reload in scala.js application while in development
I am manually reloading the Scala.js application during development. However, I need the ability to reload and immediately reflect the ...
4
votes
1
answer
316
views
Integrating Server-Side Rendering with scalajs-react
I've been trying to follow the guide of integrating server-side rendering in scalajs-react but my stack must be a little different so it's not so super straight-forward.
I'm using SBT 1.5.5, scala 2....
-1
votes
1
answer
403
views
How to differentiate between mousedown and mousedrag
I am performing some actions on onMousedown event. But then they also get executed for drag as drag starts with mouse down.
How can I ensure that actions on mouse-down don't happen for mouse drag?
...
0
votes
1
answer
34
views
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 ...
0
votes
1
answer
58
views
Radiobutton click event invoking callback 2 times
I have a radio button defined as:
<.label(
....styling
^.onClick ==> { event =>
event.stopPropagation()
props.select
},
<.input.radio(
...
1
vote
1
answer
59
views
scalajs-react : Unexpected difference in Ajax GET vs DELETE
I have following Ajax code for GET and DELETE use-cases in scalajs-react.
DELETE:
val ajax = Ajax("DELETE", "http://localhost:8081/delete/"+id)
.setRequestContentTypeJsonUtf8
...
1
vote
2
answers
45
views
scalajs-react: How to know index of the entry while looping a Seq?
How do we get hold of index while looping a collection in scalajs-react component? So basically I have code like this:
<.div(
employees.map( employee =>
<.form(
...
1
vote
1
answer
41
views
scalajs-react: How to loop a Seq of objects to populate UI
I am exploring scalajs-react. I have a usecase in which when a user clicks on a button, I fetch data from backend. Data is a list of objects. I need to display each object in a sort of form. So ...
0
votes
1
answer
92
views
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")....
0
votes
1
answer
67
views
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(...
2
votes
1
answer
293
views
Scalajs-react: Uncaught TypeError: Cannot read properties of null (reading 'value')
I have following code for my scalajs-react application:
def render(person: Person) = {
<.div(
<.p("Welcome!"),
<.form(
<.label("Name:",
...
0
votes
1
answer
160
views
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(
<....
0
votes
1
answer
118
views
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 ...
0
votes
1
answer
47
views
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!"))
...
1
vote
1
answer
343
views
scalajs-env-jsdom-nodejs run fails with UnsupportedInputException
I'm trying to put together a very simple project. It compiles, but when I try to run it, it fails with:
[error] org.scalajs.jsenv.UnsupportedInputException: Unsupported input: List(CommonJSModule(/...