fable-compiler / fable-react

Fable bindings and helpers for React and React Native
MIT License
275 stars 67 forks source link

Simplify memo usage by default #119

Closed vbfox closed 5 years ago

vbfox commented 5 years ago

This is a breaking change to memo and memoWith !

They become builder functions, producing functions that can be directly used in a render method and don't support children.

The high-level version are still available in the ReactElementType module for anyone wanting the more complete experience (Like children support, or later returning component types themselves to use in lazy).

Sample usage :

type HelloProps = { Name: string }
let hello = memoBuilder "Hello" <| fun { Name = name } ->
    span [str "Hello "; str name]

let view model =
    hello { Name = model.Name }
alfonsogarciacaro commented 5 years ago

Thanks @vbfox, looks good and comments are great! I just left a couple of suggestions.

Fable.React 4.1.3 package has already been downloaded a few times so it may be better not to unlist it. I wonder if we should start the 5 cycle and release this as alpha. Then we could also begin adding helpers for the other new React APIs (lazy, hooks) or it may be too soon?

vbfox commented 5 years ago

I don't think anyone who downloaded the package would have used memo... Beside me XD

Lazy I will add after fully testing it. Might be too soon for hooks it is still a proposal subject to change

forki commented 5 years ago

I want to. so just get the breaking stuff in so that I can start! :P

Am Mi., 7. Nov. 2018 um 11:36 Uhr schrieb Julien Roncaglia < notifications@github.com>:

I don't think anyone who downloaded the package would have used memo... Beside me XD

Lazy I will add after fully testing it. Might be too soon for hooks it is still a proposal subject to change

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fable-compiler/fable-react/pull/119#issuecomment-436580116, or mute the thread https://github.com/notifications/unsubscribe-auth/AADgNBro2O55C8O-TPZCrPxfPr9KeYp4ks5usreZgaJpZM4YRYqq .