Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 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

    (compare)

  • 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
David Barri
@japgolly
@FabioPinheiro The best way to the have a for-comprehension of AsyncCallbacks. You can use AsyncCallback.fromFuture to wrap the Futures, and .asAsyncCallback on synchronous Callbacks. That way you should end up with a nice flat for-comp like in your first snippet.
1 reply
@mn98 You're probably best looking to the React JS documentation for that. Conceptually you need to have an empty dom node in your page that React will load/mount itself into. A Scala example: https://github.com/japgolly/scalajs-react/blob/master/gh-pages/src/main/scala/ghpages/GhPages.scala#L68-L71
mn98
@mn98

@japgolly thanks for the steer, I tried to get the basic TODO app working but I just can't get it to work. I feel like I'm missing something really fundamental. I've bolted it on to the basic scalajs-tutorial from the scalajs basic tutorial in the hope that I can render both in the same document. Is that part of my problem? Fwiw, I'm trying to get the TODO app component to render like this:

  val container = dom.document.getElementById("root")
  TodoApp() renderIntoDOM container

Apologies for the simple questions here... I really appreciate the help!

nkgm
@nkgm
Kind of a naive question, but where does scalajs-react stand WRT the recent React hooks API?
Ryan Peters
@sloshy
@nkgm I don't believe it's supported right now but there's an issue tracking it japgolly/scalajs-react#510
@mn98 Is your source available somewhere?
Or did you otherwise figure out your problem
mn98
@mn98
@sloshy unfortunately I didn't figure it out on my own. I've just pushed this project to GitHub. I really appreciate it if you get a few mins to cast your eye over it. I must be getting something very simple very wrong!
Note that I pushed this directly from Intellij.
Ryan Peters
@sloshy
Now I'm not entirely sure how this project is configured because it doesn't look very extensive but, the way I've built my projects is by using scalajs-bundler. From the looks of it your app is not being bundled with anything
Or maybe that doesn't matter and I'm a noob about this method of configuration
mn98
@mn98
I tried to create the most bare bones project that I could, stripping out anything that seemed extraneous.
Ryan Peters
@sloshy
Well, bundling is definitely not extraneous :) unless you are manually putting your libraries in your sources
mn98
@mn98
Ok, sounds like that's step 1 then! :-)
Ryan Peters
@sloshy
https://scalacenter.github.io/scalajs-bundler/ <-- in case you haven't already found the docs on it
And then in your HTML you want to link to your bundled output JS file
mn98
@mn98
@sloshy ok, attempted that and pushed the changes. I still see no output when opening the html.
Ryan Peters
@sloshy
anything in your browser console?
There should be a built JS file that has bundle in the name or something. Use that instead of the current one
If it's not being built, make sure you're doing fastOptJS::webpack
mn98
@mn98
image.png
I can see the title "TODO" is correct, and in the browser console I see the above.
Ryan Peters
@sloshy
Use the -fastopt-bundle.js file in your HTML instead and you should be good
mn98
@mn98
Trying with fastOptJS::webpackyields...
image.png
Ryan Peters
@sloshy
hmm
Ah I see
You have no element with the id root
Put a <div id="root"></div> in your body above your script
Your code is looking for an element with that ID and it can't find it. I usually name mine something else like "app" so it's entirely arbitrary what you call it.
mn98
@mn98
@sloshy Hallelujah! Thank you again for your patience!!
Ryan Peters
@sloshy
Oh it's nothing, like ten minutes of my day and now somebody is up and running w/ scalajs-react
If this is your first stab at functional-ish UI (or web UI at all) then there are going to be a whole lot more moments like this, trust me
CSS in particular is a nightmare
good luck and have fun
mn98
@mn98
yes, not hard to tell that this is my first stab at web-UI and I'm going functional/compositional from the start
Ryan Peters
@sloshy
Good way to go. I went the other way around and started with jquery, knockoutJS, and then Angular 2
Then I found Scala and tried react through it. Never going back.
mn98
@mn98
sounds like I've waited until the right time then!
elkhadirzyad
@elkhadirzyad
hi every one, i have a variable val cell = getHeaderDiv(config) with type: japgolly.scalajs.react.vdom.html_<^.Ta
gMod. when i tried cell(/add some things /) it gives error: TagMod does not take parameters. in japgolly version 1.1.1 it did not give errors
David Barri
@japgolly
@elkhadirzyad instead of a(b) you now have to compose TagMods by TagMod(a, b). If you're upgrading from 1.1.1 I strongly recommend you go through all the changelogs from 1.1.1 to 1.7.0. I know it's a good 15 minutes of nothing but reading but there are plenty of other changes you'll run into as well if you're upgrading from 1.1.1. Firstly it's all documented in the changelogs; secondly, you should run the migration scripts that are in a lot of the changelogs as it will automate the majority of the upgrade for you. Good luck!
elkhadirzyad
@elkhadirzyad
Thanks, mr @japgolly , can i execute these scripts on windows os ?
Armin Keyvanloo
@arminio
Is there an up to date project skeleton available somewhere to get one started with the latest versions of scalajs and scalajs-react?
nafg
@nafg
What would you like such a skeleton to contain?
Armin Keyvanloo
@arminio
@nafg Just a working index page would be great. I can't bootstrap a new project manually. I followed the steps on scalajs-react and getting this error:
Uncaught ReferenceError: require is not defined at React.scala:41
Armin Keyvanloo
@arminio
Something like this: https://github.com/chandu0101/scalajs-react-template
But with sjs 1.1.0 and sjs-react 1.7.5
mn98
@mn98
@arminio I had similar pain recently in trying to get started with the simplest of examples. Here's a TODO app I finally got working with no small amount of help from @sloshy!
Armin Keyvanloo
@arminio
thx @mn98. If it works, it would be super helpful.
yup, it works! thanks again @mn98
you should speak with @japgolly to add it (https://github.com/mn98/scalajs-react-examples) to git repos home page as a working bare project
mn98
@mn98
Great, hope that helps. I'd be happy for it to be added, but it might need a bit of a once-over and tidy up from an expert.
1 reply
mn98
@mn98
@arminio @japgolly Hi both, fwiw I tidied up the project skeleton a bit. If it's at all helpful, please do feel free to reference/fork/whatever it.