DEV Community

loading...

Discussion on: 8 Practices In React That Will Crash Your App In The Future

Collapse
pedrootero profile image
Pedro Otero Prada

About 5:

Understand the rules. You can trick the linter into believing the code is right and still not be solving the issue. The most common case I've seen is using unique and stable values as keys in elements that are produced by iterating arrays. You could call a function that always generates a different id, and ESLint will stop complaining about it but your keys will be even worse than array indexes.

Read what the rule is about and why does it exist. Don't go just for disappearing the red line, that's how you get into worse problems than the one the linter is trying to avoid.