Closed nghiepdev closed 5 years ago
Hi all,
I have two examples with render props and don't know What is the best way? Why? Different?
Example 1:
// Layout.jsx const Layout = ({ children, aside }) => ( <div> <header>My header</header> {aside} <main> {children} </main> </div> ); // user.js import Aside from './components/Layout'; const User = () => ( <Layout aside={<Aside />}> My user page </Layout> );
Example 2:
// Layout.jsx const Layout = ({ children, aside: Aside }) => ( <div> <header>My header</header> <Aside /> <main> {children} </main> </div> ); // user.js import Aside from './components/Layout'; const User = () => ( <Layout aside={Aside }> My user page </Layout> );
Thank in advance!
Hi all,
I have two examples with render props and don't know What is the best way? Why? Different?
Example 1:
Example 2:
Thank in advance!