|
|
|
|
|
by spion
1189 days ago
|
|
Good question. component.use(SubHook, param)
could be used, that would pass the param as a second argument to the constructor.The main reason why this isn't the case, I think, is concurrent mode. Hooks force certain values to be retreived and stay stable during render (i.e. you can only get a component state value during render function) and this is important if there are multiple setup and teardowns going on. (Concurrent mode is IMO a bit of unfortunate React complexity that a lot of users of React don't really need, and many others can avoid) |
|