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

Hide an alert in scalajs-react

I'm using scalajs-react and I'd like to hide a bootstrap alert instead of removing it from the DOM. I found this javascript code here $('.alert .close').on('click', function () { $(this).parent().hide(); }) Which I wrongly translated to…
0
votes
1 answer

Adding EventListeners for UiKit events in Scalajs React

I am using this code form: dom.document.getElementById("contents").addEventListener("click", { (e0: dom.Event) => println("Got the click event at top level!") }, false) To experiment with event capturing in Reactjs. This works fine for the click…
Greg
  • 11
  • 3
0
votes
2 answers

Explanation for wrapping React HOC components with scalajs-react

I am trying to understand @trepidacious's scalajs-react wrapper for this HOC react component. 1a) Why is the type of the wrapped component here ReactComponentC[P,_,_,_] ? 1b) Why is the return type of the component ReactComponentU_ ? def…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
0
votes
1 answer

How is SBT determining the scalajs-react version to download

I'm using SBT 0.13.7 to build a Scala 2.10.4 project. I'm using Artifactory basically as a local offline cache (although this problem is present when I try to populate it, online). I've included the scalajs-react library with libraryDependencies +=…
Tim Barrass
  • 4,813
  • 2
  • 29
  • 55
0
votes
1 answer

Using a higher order react component from scalajs-react

I am trying to use this higher order react component from Scala.js using the scalajs-react library. Here is an example on how to use this component from JS: import React, {Component} from 'react'; import {render} from 'react-dom'; import…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
0
votes
0 answers

Unfold/desugar scala macro

I am trying to write my own scalajs-react components by wrapping existing JS-react components, so that they can be used from scala.js. I am trying to understand how to do that by understanding how it is done here. The problem is that I don't really…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
0
votes
1 answer

React API Rules for React's this - where are they?

What are the react api rules for React's this ? I am asking this because I am trying to understand this code: https://github.com/japgolly/scalajs-react/blob/master/core/src/main/scala/japgolly/scalajs/react/types.scala#L8 Where it is written: *…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
0
votes
1 answer

HTML inside SVG foreignobject not visible

I am struggling with an SVG, where I embed HTML via foreignobject. Here's a minimal component: val SvgDemoComponent = ReactComponentB[Unit]("Demo") .render { _ => <.svg.svg( <.svg.foreignobject( <.div("Hello From SVG") ) …
Rahel Lüthy
  • 6,837
  • 3
  • 36
  • 51
0
votes
1 answer

Update individual child component

I'm using Diode 1.0.0 with scalajs-react 0.11.1. Use case: Parent component with list of child components Child's model fragment contains Pot for asynchronously fetched image Child component fetches image when mounted and Pot is Empty, updating its…
devkat
  • 1,624
  • 14
  • 15
0
votes
1 answer

How to create a click callback with sri / scala-react?

I'm trying to create a click handler for a react component using sri & scala-react/scala-js. In the following code, the onClick handler can't be resolved. I suspect it takes a type annotation or something, but I've copied it from an example (search…
jbrown
  • 7,518
  • 16
  • 69
  • 117
0
votes
1 answer

Jquery plugin with Scala

Any one knows how to use a jquery plugin bootstrap-multiselect in scala js code. Scala.js has library which wrapped a jquery, I want to use similar statitically type code for jquery plugin finally I want to create a react component for multiselect…
Justin Patel
  • 1,323
  • 10
  • 5
0
votes
1 answer

Getting the case class instead of the trait in dynRenderR

I am working on a scalajs-react project, and I can't get the following to type check. The relevant documentation is here and here. My pages are: sealed trait Pages case class Product(id: String) extends Pages My routes are defined…
soote
  • 3,240
  • 1
  • 23
  • 34
0
votes
1 answer

How to invoke 3rd party javascript from scala-js?

I need help initializing a native JS var from within a scalajs app (specifically a scalajs-react app). Fundamentally, I'm trying to use Bootstrap Responsive data-tables and I need to initialize a data table by getting the element of the data table…
bjenkins001
  • 141
  • 1
  • 9
0
votes
1 answer

How to manipulate the meta area of the HTML dom with Scala-JS for a single page application

General Scala-JS page building advice needed. Most of the examples seem to be of the pattern where the main into which your single page application will go is between the tags in a landing page html file. How do you handle the need to insert…
bjenkins001
  • 141
  • 1
  • 9
0
votes
1 answer

Is it possible to render HTML from a ReactComponentB?

I've got an existing HTML page that I have transcribed into scalajs-react scalatags in a ReactComponentB object, but the output is slightly different from the original HTML. Is there a way I can render out the HTML from the ReactComponentB so that…
bjenkins001
  • 141
  • 1
  • 9