react-only-html-props
ohp allows to filter props to get only the react html props.
Problem :
; const ArticlesList = { return // source of the problem ({...props}) <div ...props> <ul> propsarticles </ul> </div> ;}; const App = { const articles = title: "My super article" title: "Lorem ipsum" ; const setEditingArticle = ; return <div className="App"> <ArticlesList articles=articles style= background: "#fff" setEditingArticle=setEditingArticle /> </div> ;}; ;
The code below will trigger this warning :
Warning: React does not recognize the `setEditingArticle` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `seteditingarticle` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
Fix :
;; const ArticlesList = { return // solution of the problem ({...ohp(props)}) <div ...> <ul> propsarticles </ul> </div> ;}; const App = { const articles = title: "My super article" title: "Lorem ipsum" ; const setEditingArticle = ; return <div className="App"> <ArticlesList articles=articles style= background: "#fff" setEditingArticle=setEditingArticle /> </div> ;}; ;