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

Key values are invalid in example #26

Closed
gruschis opened this issue Jun 8, 2023 · 3 comments
Closed

Key values are invalid in example #26

gruschis opened this issue Jun 8, 2023 · 3 comments

Comments

@gruschis
Copy link

gruschis commented Jun 8, 2023

Hey 👋

I was just tinkering around with your library. Thank you for starting such a project!

In your Quickstart hooks example, the keys are invalid since some of them are duplicated.

// example in the README
{days.map((dpDay) => (
  <li key={`${month}-${dpDay.day}`}>
    <button {...dayButton(dpDay, { onClick: onDayClick })}>
      {dpDay.day}
    </button>
  </li>
))}

You're interpolating the current month and the day value, so there will be duplicates with the days from the previous and the next month. I'd just print the date string representation of the $date property.

{days.map((dpDay) => (
  <li key={dpDay.$date.toDateString()}>
    <button {...dayButton(dpDay, { onClick: onDayClick })}>
      {dpDay.day}
    </button>
  </li>
))}
@Feshchenko
Copy link
Contributor

@gruschis, hi, thanks for noticing.
Do you want to make a contribution?)

@Feshchenko
Copy link
Contributor

@gruschis, hello again.
I was waiting to your contribution, but made everything by myself :)
The docs was changed in v5.2.1

@gruschis
Copy link
Author

@Feshchenko Thank you! Next time, I'll see something, I'll create a PR right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants