https://linen.dev logo
Join Discord
Powered by
# react
  • u

    user

    05/21/2019, 9:09 AM
    (new) context API can solve issues with components in totally different places
  • b

    brainy-machine-50829

    05/21/2019, 9:15 AM
    Will have to look into that one some day.
  • b

    brainy-machine-50829

    05/21/2019, 9:15 AM
    Or maybe not. UI is annoying at any level. 😄
  • u

    user

    05/21/2019, 9:15 AM
    x)
  • u

    user

    05/21/2019, 9:19 AM
    Nah, redux is ok. Storing form state in redux is not.
  • u

    user

    05/21/2019, 9:20 AM
    The new Context API would probably be better if you want to locally share state.
  • u

    user

    05/21/2019, 9:20 AM
    Or just local state in a Form component
  • u

    user

    05/21/2019, 9:20 AM
    For a form, indeed
  • u

    user

    05/21/2019, 9:29 AM
    I mean I think redux has pretty large benefits. It enforces a fuctional approach (besides ultimately the state mutation and side effect, but at least those are controlled). The single state tree makes everything predictable and allows things like easy time travel debugging by making everything a declarative action.
  • u

    user

    05/21/2019, 9:30 AM
    Obviously there are times where you want "local state" that definitely shouldn't be in redux.
  • u

    user

    05/21/2019, 9:30 AM
    The pattern behind redux is great, it just doesn't have to be applied to the whole application state
  • u

    user

    05/21/2019, 9:30 AM
    it should not be
  • u

    user

    05/21/2019, 9:30 AM
    But I still believe data should be decoupled from the view / view logic.
  • u

    user

    05/21/2019, 9:30 AM
    nobody argued against that ^^
  • u

    user

    05/21/2019, 9:30 AM
    That's also why hooks are useful.
  • u

    user

    05/21/2019, 9:30 AM
    In my first link above (dan's article on medium) there is an example of redux-style logic in a "normal" component
  • u

    user

    05/21/2019, 9:31 AM
    You can make custom hooks and reuse them across components.
  • u

    user

    05/21/2019, 9:32 AM
    hooks break referential transparency
  • u

    user

    05/21/2019, 9:33 AM
    it's trendy in the JS community to slap functional programming stickers onto everything, but if you can't get the basics right, something is broken ^^
  • u

    user

    05/21/2019, 9:34 AM
    Well I still think redux is a lot better than the approach MobX and Coconut takes with "observables".
  • u

    user

    05/21/2019, 9:34 AM
    To me it adds unnecessary complexity, and starts looking like inheritance again.
  • u

    user

    05/21/2019, 9:35 AM
    I see you're super informed on the subject ^^
  • u

    user

    05/21/2019, 9:35 AM
    Not a big fan of observables too but to be fair maybe it's just because I still haven't given them either a try or a proper look
  • u

    user

    05/21/2019, 9:35 AM
    FYI inheritance is disallowed on coconut models ;)
  • u

    user

    05/21/2019, 9:36 AM
    Yeah, to be fair I've never tried Coconut, but had a very bad experience with MobX.
  • u

    user

    05/21/2019, 9:36 AM
    Which at least on the surface it looked similar to, but again never did a deep dive.
  • u

    user

    05/21/2019, 9:36 AM
    what was the main pain point?
  • u

    user

    05/21/2019, 9:38 AM
    I just felt like it added unnecessary complexity, I don't see the point of observables, I think things felt circular when I tried to use it.
  • u

    user

    05/21/2019, 9:39 AM
    For example when someone asked about combining two state objects in an issue, they said they don't enforce anything like that, and you can encapsulate logic inside those state objects to grab data from another state object.
  • u

    user

    05/21/2019, 9:39 AM
    To me that's just like wtf.
1...789...80Latest