Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Jan 31 2019 10:57
  • Jan 30 2019 22:22
    bitpirate starred japgolly/scalajs-react
  • Jan 30 2019 08:11

    japgolly on master

    Update docs for changes in 1.4.0 (compare)

  • Jan 29 2019 13:20
  • Jan 28 2019 08:08
    booleguo starred japgolly/scalajs-react
  • Jan 28 2019 04:09

    japgolly on v1.4.0


  • Jan 28 2019 04:05

    japgolly on master

    Towards v1.4.1 (compare)

  • Jan 28 2019 04:04

    japgolly on master

    Prepare for v1.4.0 Upgrade React to 16.6.3 React.lazy and 85 more (compare)

  • Jan 28 2019 04:04
    japgolly closed #521
  • Jan 28 2019 04:04
    japgolly opened #521
  • Jan 28 2019 04:03

    japgolly on v1.4.x

    Add note about Reusability/Reus… doc formatting Prepare to release v1.4.0 (compare)

  • Jan 28 2019 04:02
    wiitht starred japgolly/scalajs-react
  • Jan 28 2019 03:18

    japgolly on v1.4.x

    Test AsyncCallback.init Update Travis CI caching (compare)

  • Jan 28 2019 03:02

    japgolly on v1.4.x

    Update Travis CI cache dirs Revise changelog (compare)

  • Jan 28 2019 03:00
    japgolly labeled #520
  • Jan 28 2019 03:00
    japgolly labeled #519
  • Jan 27 2019 17:36
  • Jan 26 2019 06:49
    japgolly commented #520
  • Jan 26 2019 05:55
    japgolly commented #519
  • Jan 26 2019 02:35
    cquiroz opened #520
the error goes away if i remove first route
any idea what's changed and how to fix this?
fixed the issue, it was just some bad regexes
Brian P. Holt

@japgolly I saw you merged #590 today, which is great! I’ve been playing with it on and off and am glad it’s going to be published

It occurred to me that I think we can add a Parallel[AsyncCallback] instance too. I was going to mention this on the ticket but thought I’d try to catch you before you release 1.6

  implicit val asyncCallbackParallel: Parallel[AsyncCallback] = Parallel.identity
AFAICT it’s a lawful instance—it passes the ParallelTests in my local branch, although there’s always a chance I missed something
If you don’t want to squeeze it into 1.6, I can make a followup PR to add it later
Hi all, anyone else seen the Multiple (2) (unconditional) routes specified error. I see it for two routes after upgrading but can't find any obvious duplication for the life of me!
it looks like I may no longer be able to mix dynamicRouteCT("foo") with an existing staticRoute("foo/bar") - does that sound like a thing?
Dan Di Spaltro
@tobyweston which version are you on? I ran into this too, couldn't quite figure out if this was an intended change or not...
Mark Kegel
i'm playing with react native, and trying to find to find a reasonable router/navigation solution. what do folks here recommend? btw, the scalajs-react router fails some place internally, so that isn't an option, despite me really wanting it to be
Roberto Leibman
@littlenag , I'm really curious about react native, particularly if it can be made to work with Android/iOS
Mark Kegel
@rleibman i'm not sure what you mean, react native does work with Android and iOS, though you have to pull in native routing solutions to get native behavior
after a bit of investigation yesterday i'm going to go with react navigation (https://reactnavigation.org/) which seems to be the default choice for the community
i dislike that i'll have to use the JS api, but i'm just putting together an MVP
typesafe bindings would be awesome, if anyone had the time to put them together
Roberto Leibman
I've got the stupid question of the day... how do I spit out raw html???
val str = "<h1>This is a header</h1>"
Roberto Leibman

Got it...

val str = "<h1>This is a header</h1>"
<.td(^.dangerouslySetInnerHtml := str)

Ugly as hell. I'm not sure why it's dangerous, but ok.

Otto Chrons
because it allows all kinds of injection attacks if the string is not static

Hello All, Could somebody help me to get through this? I use MUI to create basic Toolbar component using the following code

AppBar(position = AppBar.Position.Static)(ToolBar()()

The extract of JS interop looks like this and works well with MUI V3.1.2

  @JSImport("@material-ui/core", "AppBar")
  private object AppBarJS extends js.Object
  val jsComponent = JsFnComponent[Props, Children.Varargs](AppBarJS)

When I use the same code with MUI V 4.4.0 and I get the following message on console

Invalid JsFnComponent! You've called JsFnComponent([object Object]
  [1/8] $$typeof     : symbol    = Symbol(react.forward_ref)
  [2/8] Naked        : object    = [object Object]
  [3/8] defaultProps : undefined = undefined
  [4/8] displayName  : string    = WithStyles(ForwardRef(AppBar))
  [5/8] options      : object    = [object Object]
  [6/8] propTypes    : object    = [object Object]
  [7/8] render       : function  = function WithStyles(props, ref) {
  [8/8] useStyles    : function  = function () {)
Source: scalajsApp.external.AppBar.jsComponent (line #50)

Make sure that
  * your @JSImport / @JSGlobal annotations have the correct values
  * the JS that you're referencing has been loaded into the JS environment

If you believe this error message is wrong, please raise a scalajs-react issue
and use JsFnComponent.force as a workaround.

I tried a lot to correct the import annotations and am completely stuck now. Please help me what I need to do.

Carlos Quiroz
Are you using scalajs-bundler?
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler-sjs06" % "0.16.0")
Alexey Kaziev
Maybe it doesn't work because material-ui 4.0.0+ require react >= 16.8.0 and react-dom >= 16.8.0, but scalajs-react in current version works with react -> 16.7.0 and react-dom -> 16.7.0.
Thanks for that information. So I continue with material-ui 3.X.X for now.
James McCabe
If anybody needs to hire a (remote) Scala.js or React developer, contact me at jjtmccabe@gmail.com. I am available again.
David Barri
@kazievab scalajs-react should work fine with any React 16.x.x
@vijayemmanuel ^^
@vijayemmanuel I think you should be using JsComponent, not JsFnComponent for that component you're trying to wrap.
Alexey Kaziev

@japgolly I work in production with a facade under material-ui too, and the last time I tried to update to 16.8.0 about a year ago, I couldn't do it because of an error and I didn't try to figure out what kind of error it was, thinking that it was due to the fact that scalajs-react doesn't support it. And this was the main reason why I couldn't upgrade to the material-ui 4.X.X at that time. But after your message, I tried to update again and got the same error I got then

[error] error Couldn't find any versions for "react-dom" that matches "16.8.0 16.7.0"

After a little digging, I realized that this error actually belongs to scalajs-bundler and is solved by adding it to the project

npmResolutions in Compile ++= Map(
  "react" -> "16.8.0",
  "react-dom" -> "16.8.0"

After that, I checked it myself and it works perfectly. Thanks!


@japgolly Thanks I just corrected my work on build.sbt with

npmDependencies in Compile ++= Seq(
  "react" -> "16.8.0",
  "react-dom" -> "16.8.0",
  "@material-ui/core" -> "4.9.4",
  "@material-ui/styles" -> "4.9.0"

and the JS interop to

JsComponent[Props, Children.Varargs,Null](AppBarJS)

And it works well now with material 4.X.X. Yayy !!

any idea how to import some Button for material-ui ?
I am trying to use this button :
from here :
currently I am using React like this :
i guess i need to use scalajs-bundler, right ?
You do. Two other options for consuming material-ui are ScalablyTyped, and https://github.com/nafg/scalajs-facades
Matt Hughes
Feel like I’m going a little crazy. I have the following input, on a given change, I’m seeing modState get called twice:
                ^.`type` := "text",
                ^.onChange ==> { e: ReactEventFromInput =>
                  val value = e.target.value
                  scope.modState { s =>
                    println("Modding State")
                    s.copy(textValue = value)
                ^.value := state.textValue
That is not normal right? I’ve been doing sjs-react for like three years and if this is always how it’s been it’s news to me.

Oh FFS: facebook/react#12856

If you’re running in strict mode in dev it will purposely fire twice to ensure your methods are idempotent.

Jocelyn Boullier
Hello ! I'm trying to replicate what's done here: https://graphin.antv.vision/en/docs/manual/main-concepts/events#usage-of-event. They register a ref to the component, and then use React.useEffect, accessing the ref and calling the on method to register an event handler. I have a JsComponentfor the Graphin component which works correctly. But I have no idea how to register the on handler. I tried writing a facade for the component with an on method and I have a Ref to that facade, but I can't find how to actually call the method (i.e. the equivalent of `React.useEffect).
any plans for an sjs 1.0 release?
@nkgm follow the ticket
Using with ext-cats. Is there a way to mapN Refs?

to answer my own question:

def didMount = (ref1.get, ref2.get) mapN { case (div1, div2) =>

and since that gives a CallbackOption you can return it as is from didMount