控制台报错it looks like an unknown prop “***“ is being sent through to the DOM

Warning when custom component transfers variables

it looks like an unknown prop “***” is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via <StyleSheetManager shouldForwardProp={...}> (connect an API like @emotion/is-prop-valid) or consider using transient props ($ prefix for automatic filtering.)

Insert image description here

This means that we transferred an unknown prop variable to the DOM, triggering a React warning. To eliminate the warning, we can install a similar plug-in or add a symbol @emotion/is-prop-validin front of the incoming variable . I use the symbol to solve the problem here (note that from props Also add when taking the value )$$$

Before changing

  • incoming
    Insert image description here
  • use
    Insert image description here

After changing

  • incoming
    Insert image description here
  • use
    Insert image description here

Guess you like

Origin blog.csdn.net/weixin_42560424/article/details/133015413