Question about variables in module behavior
The reason you are seeing this is because of JavaScript. Here’s the compiled JS from what you wrote: // Generated by ReScript, PLEASE EDIT WITH CARE let state = []; function make(foo) {...
View ArticleGeneral build overview/tutorial for ReScript projects?
Here’s something quick I threw together: GitHub - jderochervlk/rescript-parcel-no-framework: A simple example of a webapp using Parcel with no framework, just WebAPIs. I’m using Parcel as the build...
View ArticleQuestion about variables in module behavior
Got it; sounds like expected behavior, thanks!
View ArticleQuestion about variables in module behavior
you would actually get the same behavior in ocaml, go to ocaml playground and copy paste this: module MyModule = struct let state = ref([]) let make (foo: string) = state := foo :: !state; state end...
View ArticleGeneral build overview/tutorial for ReScript projects?
this is a very interesting question and I think it boils down to the philosophy of the project compared to Elm/ClojureScript. The latter are meant to be battery included, fully integrated, while...
View ArticleGeneral build overview/tutorial for ReScript projects?
Refactor React to ReScript Browser Extension Widgets - App in a week day 2 last year I made a little chrome extension with ReScript and React. Started from Hello World, adding React then adding...
View ArticleGeneral build overview/tutorial for ReScript projects?
tsnobip: while ReScript is seen as a drop-in replacement of JS, a compiler that generates regular JS and that is meant to Just Work TM with the rest of the JS ecosystem. This is the great part about...
View ArticleGeneral build overview/tutorial for ReScript projects?
jderochervlk: Do you want a single HTML file that just loads in JS? As I tried to explain above, the intent is really to have one codebase for a multi-page application (i.e. one shared bundle and one...
View ArticleWeb frontend frameworks ReScript can work with in 2024?
Yep, indeed the latest rewatch master tries to build it. But I’m getting a handful of errors similar to this: The field hxBoost does not belong to type JsxDOM.domProps. So it appears it doesn’t...
View ArticleTyping a useState
Hello, I am having some minor problems with a small thing. On my playground below I make the compiler understand what I want to do with the following line | Loaded(asd: user) => but I would prefer...
View ArticleTyping a useState
There’s a few different ways to approach it, but the simplest in your example would be to type the return type of the useState function: let (user, setUser) = React.useState((_): loadable<user,...
View ArticleGeneral build overview/tutorial for ReScript projects?
jderochervlk: Here’s something quick I threw together: GitHub - jderochervlk/rescript-parcel-no-framework: A simple example of a webapp using Parcel with no framework, just WebAPIs. This looks very...
View ArticleGeneral build overview/tutorial for ReScript projects?
What you’re looking for is a “Multi Page” application. A lot of the tooling out there focuses on either a single entry file (Single Page App) or Server Side Renderring, but a Multi Page app generates...
View ArticleCompile and use in ts project
Hi, I was wondering if its possible to build a library that can be used in a pure js project and if so what steps are needed? What I would want is to build stuff in rescript and then use it in my pure...
View ArticleTyping a useState
you can also annotate in the tuple: let (user: loadable<user, 'e>, setUser) = React.useState(_ => Loading) Might be a bit more idiomatic.
View ArticleCompile and use in ts project
Hey! I don’t think ReScript has a seamless story for building JS libraries. Additional bundler features can make it possible, but the truth is that finding a good build tool for your library is still...
View ArticleCompile and use in ts project
Before the library mode, my current recommendation is to use tshy as an additional build tool for genType’s .ts outputs.
View Article[ANN] New module function page
We finally published a documentation page about module functions. We call them like that now since we think the old name (functor) is not as descriptive. Thank you @joshderochervlk! ReScript...
View Article