I\'m trying to find the proper way to define some components which could be used in a generic way:
The best way, which allows you to make property transfer is children
like a function pattern
https://medium.com/merrickchristensen/function-as-child-components-5f3920a9ace9
Code snippet: https://stackblitz.com/edit/react-fcmubc
Example:
const Parent = ({ children }) => {
const somePropsHere = {
style: {
color: "red"
}
// any other props here...
}
return children(somePropsHere)
}
const ChildComponent = props => Hello world!
const App = () => {
return (
{props => (
Bla-bla-bla
)}
)
}