Expected to return a value in arrow; function array-callback-return. Why?

后端 未结 4 1220
日久生厌
日久生厌 2021-01-07 17:59

I\'m having some issues understanding why I\'m getting a compile warning on this piece of my react code

fetch(\'/users\')
        .then(res => res.json())         


        
4条回答
  •  半阙折子戏
    2021-01-07 18:27

    Try Changing map(() => {}) to map(() => ())

    {} - Creates a code block that expects an explicit return statement.
    With () - implicit return takes place.

提交回复
热议问题