Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Mention that we prefer importing from @wordpress/element instead of react #6732

Closed
sunyatasattva opened this issue Jul 21, 2022 · 2 comments · Fixed by #8520
Closed

Mention that we prefer importing from @wordpress/element instead of react #6732

sunyatasattva opened this issue Jul 21, 2022 · 2 comments · Fixed by #8520
Assignees
Labels
focus: documentation This issue is a request for better documentation. type: cooldown Things that are queued for a cooldown period (assists with planning).

Comments

@sunyatasattva
Copy link
Contributor

In our repo we want to try to avoid importing directly from react as a policy. Instead, developers should use @wordpress/element. I was informed of this by @Aljullu on this PR, but I hadn't noticed myself, as our repo is a bit inconsistent (92 instances of importing from react vs 154 of importing from @wordpress/element).

However, the philosophy behind this is very solid: we want an abstraction layer so we don't have to rely on a specific underlying implementation. As such, me and @Aljullu agree that this preference should be indicated somewhere in the repo docs, and—I should add—we should perhaps migrate all the current react imports to @wordpress/element.

@sunyatasattva sunyatasattva added focus: documentation This issue is a request for better documentation. type: cooldown Things that are queued for a cooldown period (assists with planning). labels Jul 21, 2022
@gigitux
Copy link
Contributor

gigitux commented Sep 1, 2022

Thanks for opening this issue, @sunyatasattva!
I think that it makes sense to add a dedicated eslint rule as in Gutenberg.

@sunyatasattva
Copy link
Contributor Author

Yiss please

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: documentation This issue is a request for better documentation. type: cooldown Things that are queued for a cooldown period (assists with planning).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants