I'm trying to create a HOC which adds a tooltip (later can be more reusable). I've come up with a few working solutions using other methods, but I'd like to make it as simple as possible to use.
Basically, I want to know if there is anyway to force my <Div />
component to render its children without adding {props.children}
to the <Div />
. If that's possible somehow, then I could really make this better in the future.
import { nest } from 'recompose';
const Tooltip = () => <div style={{ position: 'absolute', top: 0, left: 0, height: '20px', width: '20px', backgroundColor: 'red' }} />;
const Div = (props) => {
console.log(props);
return (
<div
style={{
backgroundColor: '#F2F2F2',
height: '400px',
}}
>
<h1>content here</h1>
</div>
);
};
const DivWithTooltip = nest(Div, Tooltip);