Quantcast
Channel: ReScript Forum - Latest posts
Browsing all 1751 articles
Browse latest View live

Rendering Recursive React Components

This example says you can: Recursive components in React: A real-world example - LogRocket Blog I updated my playground example with a useState and it works: ReScript Playground I don’t see any...

View Article


Rendering Recursive React Components

You can certainly use recursive components in react. However: the blog post relies on actually rendering the components via JSX, which means react is actually cutting new components. By calling make...

View Article


ReScript RPC like?

Sorry, I was really busy recently. Contributions are welcome. I think it should be really similar to Fastify integration, which you can use as a reference.

View Article

Rendering Recursive React Components

Good news though; we can manually wrap the child renders in createElement to fix that. See this (admittedly hacky) example.

View Article

Image may be NSFW.
Clik here to view.

Rendering Recursive React Components

Gotcha. So it turns out the way I solved it with React.createElement is the right way to do it. Thank you all! joakin: module Item = { @react.component let rec make = (~item: item<'a>) => {...

View Article


Problem with UltimateExpress bindings

I might have misunderstood, but couldn’t you do this instead: module Router = { type t @module("ultimate-express") @scope("default") external make: unit => t = "Router" } When used, it generates:...

View Article

Problem with UltimateExpress bindings

Something in the back of my head told me I was forgetting something. Dur.

View Article

Difficulties with functors and abstract types

I think my problem is that having a module type intended for use by a Module Function, when having an abstract type, the Module Function only sees the abstract type as abstract (Ok that probably...

View Article


Difficulties with functors and abstract types

Just remove the FunctorType type annotation on MyMod module MyMod = { type a = string // this is where I want to set the type let injectedRun = (x: a) => Console.log(x) } Modules are structurally...

View Article


Difficulties with functors and abstract types

It is possible to get this to work for concrete types while retaining the module type signature. It relies on explicitly setting the type of FunctorType.a in MyMod’s type signature. You would need to...

View Article

Difficulties with functors and abstract types

@glennsl has it right, you just need to remove the type annotations on the modules. module type FunctorType = { type a // "type a = string" works but I want to set the type in MyMod let injectedRun: a...

View Article

Image may be NSFW.
Clik here to view.

Idea I am using to avoid using React.string

Having to use React.string can be annoying for text heavy applications and components. I fully understand why it’s needed, so no complaints, but I have been testing out an idea and I think I like it....

View Article

Idea I am using to avoid using React.string

Oh I’m actually bootstrapping a documentation portal, and am now going to be stealing this idea for the components… let make = () => <APIDocs> <Summary> "Lorum ipsum" </Summary>...

View Article


Using a scoped polymorphic type for react-router bindings to loader function

I’ve just also run into a similar problem as Error: Field value has a type which is less general than the (defined) scoped polymorphic type writing bindings for react-router v6: This type definition...

View Article

Using a scoped polymorphic type for react-router bindings to loader function

Unfortunately this can’t work, why don’t you just make RouteObject polymorphic?

View Article


Idea I am using to avoid using React.string

Having a <Typography> component is always a good idea.

View Article

Using a scoped polymorphic type for react-router bindings to loader function

The target data seems dependent on the Settings component and not a generalized type. And these original types are actually polymorphic at the implementation level. Making the polymorphism explicit or...

View Article


Image may be NSFW.
Clik here to view.

Using a scoped polymorphic type for react-router bindings to loader function

Ah, so I left out some critical context here. RouteObjects are made into an array (tree) that is then passed to the create*Router functions: let routes = [ { RouteObject.id: "root", path: "/",...

View Article

Using a scoped polymorphic type for react-router bindings to loader function

I usually use a module type abstraction for it. Something like: module type Entry = { type loaderData let element: unit => React.element } It adds overhead but it’s just wrap/unwrap. And I guess it...

View Article

Using a scoped polymorphic type for react-router bindings to loader function

If you don’t need to access those polymorphic functions from rescript, this would work: module RouteObject = { @unboxed type rec t = Route({ id: string, caseSensitive?: bool, children?:...

View Article
Browsing all 1751 articles
Browse latest View live