Git Product home page Git Product logo

Comments (2)

milankinen avatar milankinen commented on June 26, 2024

Hi @dqdinh and sorry for delayed answer. I completely missed this issue... Sorry about that.

Yeah I know that Buses/Subjects are considered as bad practice in FRP but in React's case they are unfortunately the only way create actions from UI. The reason is that event streams must be known when building the application state ("addItem", "remove", ...) but the UI is instantiated ad hoc ("add item" button may not be visible during the first render).

Thus the following circular dependency is introduced:

<app-state> ---depends on---> <ui-action-streams> ---depend on---> <app-state> 

The break this circular dependency, <ui-action-streams> must be created before <app-state>. And because action streams are created before the UI, there is no chance to emit events into them (due to immutable characteristics of EventStreams) unless they are buses/subjects. Thus, buses/subjects seem to be the only option for now..

I you have an implementation with FRP & React without using buses/subjects, I'd gladly look at it and get some inspiration how to do this "better". :-)

I've created (yet another) Flux library that hides the ugly implementation details of buses/subjects and focuses on functions and event streams instead. You can take a look at it: https://github.com/milankinen/ffux

from react-bacon-todomvc.

dqdinh avatar dqdinh commented on June 26, 2024

thanks

from react-bacon-todomvc.

Related Issues (4)

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.