reagent

Drew Verlee 2026-01-05T23:12:29.892289Z

A form-2 is just a form 3 where it's (defn foo [] (component-did-mount-fn) reagent-render-fn) right?

p-himik 2026-01-06T08:56:14.190859Z

> weird... did it change from did to will in some version? I did not mean it as a lifecycle method. It's just that (component-did-mount-fn) in your code above will actually be called before the component is mounted. Because, well, in order for something to be mounted, you have to create that something. And when foo is called (when (component-did-mount-fn) is executed), that something is just being created.

Drew Verlee 2026-01-05T23:12:56.919609Z

As in a form-2 is a more restricted then a form-3

p-himik 2026-01-05T23:19:54.934669Z

s/did/will and it'll become true, AFAIK. Yeah, form-2 is more restricted and also more succinct.

p-himik 2026-01-05T23:25:21.723199Z

Just in case - there's also r/with-let. Allows you to have a form-2-like component but with form-1 syntax and with an ability to run some code when the component is unmounted.

👍 1
Drew Verlee 2026-01-05T23:30:19.771739Z

Yep, i'm aware (though only recently lol).

Drew Verlee 2026-01-05T23:44:30.163229Z

@p-himik weird... did it change from did to will in some version? our app says "will" as do the docs here: https://github.com/reagent-project/reagent/blob/master/doc/CreatingReagentComponents.md#form-3-a-class-with-life-cycle-methods

Drew Verlee 2026-01-05T23:45:30.952649Z

or wait, are those are different lifescycle methods...

Drew Verlee 2026-01-05T23:48:01.802299Z

oh it's component-will-unmount and component-did-mount (i guess it helps you orient the time around the render?)

Drew Verlee 2026-01-05T23:57:18.501079Z

is this https://github.com/reagent-project/reagent/blob/master/doc/CreatingReagentComponents.md#appendix-b---with-let-macro? It says > The with-let macro looks just like let – but the bindings only execute once, and it takes an optional finally clause, that runs when the component is no longer rendered. This can be particularly useful because it can prevent the need for a form-2 component in many instances (like creating a local reagent atom in your component) Did it mean "form-3" where it said "form-2"?

Drew Verlee 2026-01-06T00:11:51.190249Z

I guess it wouldn't, but it's wording is confusing, because it says "like creating local reagent atom in your component" doens't a form let you do that anyway? I feel like it should say "when you need to clean up some state created by the component" which a form-2, to my knowledge has no place for.

Drew Verlee 2026-01-06T00:20:49.202379Z

i guess it also handled component-did-mount... https://cleancoders.com/blog/2025-02-01-goodbye-reagent-class-components-using-reagents-with-let-macro