Giter Club home page Giter Club logo

Comments (4)

MangelMaxime avatar MangelMaxime commented on June 2, 2024 1

Because useElmish is already used in the application, I would stick with useElmish for consistency and because in the future if the component needs to evolve it will avoid a re-write/translation from one system to another.

from feliz.

MangelMaxime avatar MangelMaxime commented on June 2, 2024

useReducer is a native React feature which probably explains the lack of documentation around it. https://react.dev/reference/react/useReducer

useReducer and useElmish kind of overlap in term of scope but the main difference is that useElmish should allow to use libraries from Elmish ecosystem like debouncer, etc. Plus as you noted the benefit of generated messages to handle complex.

useReducer was introduced by the React team, to kind of include Redux in React directly without having to install an external dependency. I am not sure if this succeeded in archiving the goal they had in mind.

You can mix them, in your application but I think for consistency it is probably better to stick with one.

from feliz.

LuisFX avatar LuisFX commented on June 2, 2024

Hi @MangelMaxime! Thanks for the insight.

Yes, I understand that useReducer is part of the React api, and also that it was a way to bundle a redux-like solution into React to manage complex state.... this is the reason I'm interested to know if is there is a place for useReducer within our app for simple situations where useState is not sufficient to manage state (because of deeply nested components) BUT useElmish might** be overkill for adding a "simple" state machine into a component. Basically, is useReducer recommended at all within a Feliz app? (or was it only added just for better coverage of the React API?).

After all, the Elmish lib it's tiny, and already loaded in our app.

(** I say might, because useElmish is simple enough to implement! )

Thanks again! Cheers.

from feliz.

LuisFX avatar LuisFX commented on June 2, 2024

Got it! Thanks much... sitcking to useElmish!

from feliz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.