Too many React Context providers

前端 未结 5 1829
渐次进展
渐次进展 2021-01-31 17:39

New to react here and trying to wrap my head round the new Context API (I haven\'t looked into Redux etc. yet).

Seems I can do much of what I need to do, but I\'m going

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-31 18:18

    Use @rista404's answer - https://stackoverflow.com/a/58924810/4035
    as react-context-composer is deprecated.

    Thanks @AO17, for the ping.


    Disclaimer: I've never used this, just researched.

    FormidableLabs (they contribute to many OSS projects) has a project called, react-context-composer

    It seems to solve your issue.

    React is proposing a new Context API. The API encourages composing. This utility component helps keep your code clean when your component will be rendering multiple Context Providers and Consumers.

提交回复
热议问题