React useReducer async data fetch

前端 未结 6 674
臣服心动
臣服心动 2020-11-30 22:36

I\'am trying to fetch some data with new react useReducer API and stuck on stage where i need to fetch it async. I just don\'t know how :/

How to place data fetching

6条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 23:38

    I wrote a very detailed explanation of the problem and possible solutions. Dan Abramov suggested Solution 3.

    Note: The examples in the gist provide examples with file operations but the same approach could be implemented for data fetching.

    https://gist.github.com/astoilkov/013c513e33fe95fa8846348038d8fe42

提交回复
热议问题