Repository navigation
Why are previously public utilities now bundled as private? #10256
Replies: 2 comments 4 replies
|
These were never publicly documented. Yes you can import them but that doesn't mean we recommend their use. |
|
Is it still valid to import these directly from @react-aria/collections, or is that not recommended? Reason I ask is because certain things like #5912 seems to suggest that access to these collection exports is intended for public usage, but only The docs for Lists, Menu, Tabs etc explicitly import The reason I ask is because there are cases where I'd like to build my own components using the hooks, but keep compatibility with other RAC components without needing to reimplement everything. Utility functions are not a big deal to reimplement but even the examples for things like Menu use these private exports, Are they not recommended for use because users should generally use the prebuilt components, or are they not recommended for use because they may change between patches and are unstable? And since the individual |
Uh oh!
There was an error while loading. Please reload this page.
Why are previously public utilities now bundled as private? I know they can still be imported from the private path but I don't understand why they are marked as "private". Part of the idea of the headless API is that you can build custom behavior/hooks using the same internals as what the primary hook API offers. In order to do so, you pretty much have to use these private utils.
For example, previously I could
import { focusSafely } from '@react-aria/focus. Now I have to go fetch this utility from a "private" path:import { focusSafely } from 'react-aria/private/interactions/focusSafely'Instead, I propose that the now private utils should be just exported as standard utils using the existing
"exports": "./*"wildcard system. So in my above example, the import would instead beimport { focusSafely } from 'react-aria/interactions/focusSafely'All reactions