What does it mean that React context's Consumer wraps Provider?

as follows, it is the source code in the drawer of antd. The Consumer of DrawerContext in the code actually wraps the Provider,. Isn"t it all Provider that wraps Consumer? how do you understand it?

  here  

Nov.25,2021

eact-redux is an official solution, and Provider itself doesn't do much, just putting store in context. In fact, if you use react-redux, the best way to connect the view to the data layer is to use the connect function. In essence, Provider is to provide store for connect.


I just looked at the source code and adjusted the single test. I found that Context, is never used in Drawer and the instantiation of Context is carried out in Provider, so I understand that Provider should be wrapped in Consumer,Consumer to retrieve the instantiated Context content of Provider.

The value in the renderProvider callback parameter in

Drawer is always the default value passed in createReactContext when null, is returned by default in Consumer if the Context, passed in the context is not taken, so I don't know whether this is the bug of antd or someone else wrote it on purpose.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d21c-408f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d21c-408f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?