Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad coding practice in the example #7432

Closed
SmileHub opened this issue Nov 25, 2024 · 1 comment · Fixed by #7473
Closed

Bad coding practice in the example #7432

SmileHub opened this issue Nov 25, 2024 · 1 comment · Fixed by #7473
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@SmileHub
Copy link

🙋 Documentation Request

In https://react-spectrum.adobe.com/react-aria/Calendar.html#calendargridheader
the hook is called conditionally:
let formatted = date ? useDateFormatter().format(date) : 'None';

which is a bad practice in react. I'd suggest something like this, or alike:

const {format}= useDateFormatter();
let formatted = date ? format(date) : 'None';

🧢 Your Company/Team

No response

@snowystinger snowystinger added the documentation Improvements or additions to documentation label Nov 26, 2024
@snowystinger
Copy link
Member

Looks like a fine alteration. The general guiding principles of our docs is to keep the examples short, this won't expand it by much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants