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

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( <.label("Name of the employee:", …
Mandroid
  • 6,200
  • 12
  • 64
  • 134
1
vote
1 answer

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 basically it would be a series of divs I assume. So how…
Mandroid
  • 6,200
  • 12
  • 64
  • 134
1
vote
1 answer

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:…
esgott
  • 78
  • 8
1
vote
1 answer

How would I build a Bootstrap React Modal using Scala Js React

How would I create a Modal component from the React Bootstrap library using the Scala.js React library?
user79074
  • 4,937
  • 5
  • 29
  • 57
1
vote
1 answer

How to render a React.Suspense?

I'm trying to render a React.Suspense on an empty page, but failed with the following error: Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got:…
thirstycrow
  • 2,806
  • 15
  • 18
1
vote
1 answer

scalajs and webpack4 config settings issues

I am using webpack 4.20.2 and scalajs ("0.6.24") , scalajs bundler(0.13.1) when i am building bundle file i am getting below webpack exceptions. I am attaching build.sbt which uses webpack.config.dev.js and generate scalajs-webpack.config.js . If i…
donald
  • 478
  • 8
  • 19
1
vote
1 answer

First click on button has an odd behaviour

I am working on a todo list app using scalajs, cats (free monads), and scalajs-react When I am using a simple model like the code below, everything works like expected. class TodoModel() { private object State { var todos = Seq.empty[Todo] …
user1091344
  • 612
  • 6
  • 27
1
vote
1 answer

How to understand this code line?

What is this code line doing? Is this syntactic sugar for another notation? def createItem(itemText: String) = <.li(itemText) <.ul(props map createItem: _*) <-- this one
user1091344
  • 612
  • 6
  • 27
1
vote
1 answer

React with references in immutable data

I'm looking for input on a way to deal with issues arising with the use of id/ref links in immutable data (specifically with React using Scala-js and scala-js-react, but I think the solutions are probably common to any similar system, e.g. React in…
trepidacious
  • 592
  • 4
  • 9
1
vote
1 answer

Rendering React (scalajs-react) component with Diode error

I'm going to use Diode to manage application state with unidirectional data flow. I use Playframework 2.4 and Scala.js and here is a part of build.sbt for client subproject: libraryDependencies ++= Seq( ... "me.chrons" %%% "diode" %…
Alex Karasev
  • 1,108
  • 2
  • 13
  • 24
1
vote
1 answer

Pretty URLs (without '#') on scalajs-react Play app

In the documentation for scalajs-react's router, @japgolly cautions users of the library that starting URLs with '/' slashes requires additional server configuration. To allow pretty URLs without #, so far I've tried to write a catch-all route in…
Zachary Albia
  • 71
  • 2
  • 7
1
vote
1 answer

ReactComponent vs ReactComponentElement in scalajs-react

I am trying to write some extra scalajs-react documentation but I am confused. It says here : A ReactElement is a ReactDOMElement or a React component. But it says here: type ReactElement = ReactComponentElement | ReactDOMElement; Which one is…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
1
vote
1 answer

What is a react callback in scalajs-react?

Here it is written: Included is a type CallbackTo[A] which captures effects designated for use in React callbacks. What is a React callback in this context ?
jhegedus
  • 20,244
  • 16
  • 99
  • 167
1
vote
2 answers

Looping on an interval of audio element with scalajs-react

I want to build a little component containing an audio element, which capable of looping on an interval. The two ends of the interval would be a defined as properties of the component. As the timeUpdate event don't have the necessarily precision (I…
mutantacule
  • 6,913
  • 1
  • 25
  • 39
1
vote
1 answer

How would I use nesting of selectors CSS in ScalaCSS?

How can I specify properties to selectors within other selectors. For example #top { background-color: #ccc; padding: 1em} #top h1 { color: #ff0;} #top p { color: red; font-weight: bold;} How to write above CSS in ScalaCSS?