ReScript is a language and compiler toolchain for building performant, easy-to-maintain JavaScript and ReactJS applications. It is a strongly typed language with many interoperability features to integrate nicely in existing JavaScript codebases.
Questions tagged [rescript]
78 questions
1
vote
2 answers
What is the best practice of iterating record keys and values in Reasonml?
I'm new to ReasonML, but I read through most of the official documents. I could go through the casual trial and errors for this, but since I need to write codes in ReasonML right now, I'd like to know the best practices of iterating keys and values…

Sanghyun Kim
- 161
- 1
- 12
1
vote
2 answers
How to String matchAll in Reason?
I'm trying to replicate what I would do in javascript with matchAll()
const names = [
...withoutSlashes.matchAll(/(?<=Pos\. \d+ \- )(.*?)(?=","Importe)/g),
];
I see Reason has Js.String.match but I can't find the matchAll. I guess it's…

cuadraman
- 14,964
- 7
- 27
- 32
0
votes
1 answer
Getting data from Rescript input fields
I have this code for two input fields and a button: I have this code at the end:
…
0
votes
0 answers
Getting FormData with rescript
I have a Rescript react component which contains a form. I am trying to get the FormData when the form is submitted, but I am a bit confused about how to do that.
My component:
@react.component
let make = () => {
let (todos, updateTodos) =…

Redark
- 173
- 1
- 11
0
votes
1 answer
CSS won't load when using CSS modules
I am trying to write a simple react component in rescript and have a CSS file for the component. I am trying to do this with Webpack.
Here is my entire project code
Webpack.config.js
const path = require("path");
const HtmlWebpackPlugin =…

Knows Not Much
- 30,395
- 60
- 197
- 373
0
votes
0 answers
Creating a vs code extension using Rescript
I am new to using rescript and trying to convert an extension I started writing in typescript into rescript. I cannot figure out how to access the vs code extension api though.
Is there a way to create a vs code extension solely using rescript or…

Salamander987
- 1
- 1
0
votes
1 answer
How to do ReactDOM.createRoot?
I wrote this code
switch (ReactDOM.querySelector("#myapp")) {
| Some(myapp) => ReactDOM.createRoot(myapp).render( )
| None => Js.log("we could not find myapp div!"); ()
};
However Rescript compiler complains The value createRoot can't…

Knows Not Much
- 30,395
- 60
- 197
- 373
0
votes
0 answers
I am trying to deploy an ReScript project on vercel but the build fails
I have a portfolio app written in ReScript and i am trying to deploy it live with vercel(i also tried other platforms) and i am failing the build phase saying
While resolving: @rescript/react@0.10.2
npm ERR! Found: bs-platform@4.0.18.

Klei Aliaj
- 11
- 4
0
votes
2 answers
Convert Json array to list of strings
I am reading this tutorial https://www.stackbuilders.com/blog/nonsense-getting-started-with-reason-and-reason-react/. One of the problems I am facing is that api.noopschallenge.com is now dead. I replaced the API call to this…

Knows Not Much
- 30,395
- 60
- 197
- 373
0
votes
1 answer
pass type to module for abstract data type
I am trying to create a heap module (and eventually priority queue) implemented with an array.
The portion of the heap I have written so far compiles fine:
module MinHeap = {
type elem
type heap = array
let make = (): heap => []
let…

akaphenom
- 6,728
- 10
- 59
- 109
0
votes
1 answer
Rescript manipulate JSON file
I have this JSON file.
Using rescript I want to :
Read the file.
Extract data from the file.
Write result in a new file.
{
"name": "name",
"examples": [
{
"input": [1,2],
"result": 1
…

Fer iel
- 23
- 4
0
votes
1 answer
Is a simple way to use `Belt.Set` (and others) fixing its type?
I'm creating a functor for opaque identifiers to allow the type system help catching issues where you're supposed to have an identifier of A, but you're being given an identifier of B.
I've already have the core of it working, but I want some…

manu
- 3,544
- 5
- 28
- 50
0
votes
1 answer
Is there a way to convert curried functions to uncurried functions?
The map function in rescript-json-combinators accepts only uncurried functions and the functions we are using are curried.
What is the best way to go around this? I don't know if there is a way to convert curried functions to unccuried functions or…

Fer iel
- 23
- 4
0
votes
1 answer
Trying to decode an event using rescript-json-combinators
Trying to create an equivalent for decodeEvent using rescript-json-combinators. I couldn't figure out how to replace "Decoder(decoder)" since Decoders have been made abstract in rescript-json-combinators. Trying to use Decode.decode didn't work.
Any…

Fer iel
- 23
- 4
0
votes
1 answer
How to embed raw JavaScript containing template literals in ReScript?
For example, the following ReScript does not compile:
%%raw(`
const s = 'world';
const msg = `Hello ${s}!`;
console.log(s);
`)
The ReScript compiler (10.0.1) errors out at the backtick before Hello:
Syntax error!
3 | const msg = `Hello…

weakish
- 28,682
- 5
- 48
- 60