简体   繁体   中英

withState vs. withStateHandlers

The docs @ https://github.com/acdlite/recompose/blob/master/docs/API.md#withstate says this regarding withState

You'll likely want to use this state updater along with withHandlers() to create specific updater functions.

Then it has a separate function withStateHandlers() which seems similar though in a slightly different form.

In terms of practical use and why one would be used instead of the other, how do they differ?

Actually withStateHandlers() hasn't appeared until recently version of recompose. I'd recommend that use withStateHandlers() instead of combining withState() and withHandlers() if you can.

The doc under withState() probably need update.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM