0

From React 16.13.1 class attribute can work but still throws a "warning" exception.

I want to use the class attribute everywhere I can instead of className, because it plays nicely with HTML chanks. But the warning is polluting my console.

so how I can CONFIG react-app to stop the warnings?

dcts
  • 1,479
  • 15
  • 34
pery mimon
  • 7,713
  • 6
  • 52
  • 57
  • "React 16: Warns but converts values to strings and passes them through. Note: always use the canonical React naming for all supported attributes." - [source](https://reactjs.org/blog/2017/09/08/dom-attributes-in-react-16.html#changes-in-detail) so why do you want to use class everywhere? It is still jsx / tsx, so there should be a distinction, because it is clearly no html – SirOneOfMany May 04 '22 at 07:38
  • https://stackoverflow.com/questions/64158705/ignore-certain-console-errors-warnings-in-react – SirOneOfMany May 04 '22 at 07:38
  • because `class` is the right HTML attribute name for the CSS class. So it is how it should be and it makes it easy to copy&paste HTML chank to the JSX file – pery mimon May 04 '22 at 07:58
  • Yeah it is the right html attribute but _JSX IS NO HTML_ – SirOneOfMany May 04 '22 at 08:00
  • Does this answer your question? [Ignore certain console errors / warnings in React?](https://stackoverflow.com/questions/64158705/ignore-certain-console-errors-warnings-in-react) – SirOneOfMany May 04 '22 at 08:01
  • @SirOneOfMany that is for another Debate. – pery mimon May 04 '22 at 08:06
  • @SirOneOfMany I'm looking for something to do with a config file. because React actually allows this but still warns about it. I guess there should be some flag that turns it off – pery mimon May 04 '22 at 08:08
  • Does this answer your question? [Override eslint settings in non-ejected create-react-app?](https://stackoverflow.com/questions/60289601/override-eslint-settings-in-non-ejected-create-react-app) and the actual rule to disable is https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md – Gabriele Petrioli May 04 '22 at 08:09
  • @GabrielePetrioli Great. it's not the final answer but sure it's in the right direction. – pery mimon May 04 '22 at 08:14

0 Answers0