preactjs / preact-compat

ATTENTION: The React compatibility layer for Preact has moved to the main preact repo.
http://npm.im/preact-compat
MIT License
950 stars 148 forks source link

Export hooks #524

Closed dy closed 5 years ago

dy commented 5 years ago

Just followed the transition guide https://preactjs.com/guide/switching-to-preact, and getting an error that useCallback hook is not defined. There seems to be no docs in preact/preact-compat about hooks so far.

Any chance we can get import React, {useState, useMemo} from 'preact-compat' soon?

marvinhagemeister commented 5 years ago

It's already there just under a different import. The package preact-compat (note the minus sign) is for Preact 8.x. For our next major release Preact X we moved compat into core and can be imported via preact/compat.

Because X is still in alpha we haven't updated our docs. Once X is marked as stable we'll update our accordingly. Doing it now would confuse users because npm points to Preact 8.x by default. The alpha on the other hand can only be installed when the user specifically opts in to that.