How to implement service(concept in AngularJS) -like component in React

后端 未结 5 1943
忘掉有多难
忘掉有多难 2021-02-01 17:45

All:

I am pretty new to React from AngularJS. In AngularJS, there is service dependency inject which can provide a service instance to do data fetching, processing, etc

5条回答
  •  耶瑟儿~
    2021-02-01 17:57

    An Extension to Michael Dunn's Answer

    This is the actual answer ,

    • Service pattern is not limited to any programming language or library.

    • We can implement this concept in any language , Even we can implement this in react

    • A tiny service can be created on server OR in ui browser in Javascript that serves some logical purpose

    • It gives us benefits of code availability, code management , code isolation of particular logic

    • Its a very native way for code availability, code management , code isolation of particular logic

    • If we compare redux/flux vs services ,redux/flux also serve these purpose's

    • Currently i am using redux and its actions , and also created my tiny services on ui when required.

    • No need to use OTHER NPM MODULES FOR CREATING SERVICES , Just Michael Dunn's solution is enough

提交回复
热议问题