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 ArticleRendering 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 ArticleReScript 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 ArticleRendering Recursive React Components
Good news though; we can manually wrap the child renders in createElement to fix that. See this (admittedly hacky) example.
View ArticleRendering 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 ArticleProblem 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 ArticleProblem with UltimateExpress bindings
Something in the back of my head told me I was forgetting something. Dur.
View ArticleDifficulties 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 ArticleDifficulties 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 ArticleDifficulties 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 ArticleDifficulties 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 ArticleIdea 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 ArticleIdea 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 ArticleUsing 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 ArticleUsing 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 ArticleIdea I am using to avoid using React.string
Having a <Typography> component is always a good idea.
View ArticleUsing 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 ArticleUsing 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 ArticleUsing 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 ArticleUsing 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