I want create a component which be a DIV with a custom style: background color blue. After that, I want instance it and add text as children. I am trying do it so:
WRAPPER:
import React from 'react';
export default class Wrapper extends React.Component {
constructor() {
super();
}
render() {
const { children, ...props } = this.props;
return (
<div style="background-color: blue" {...props}>
{children}
</div>
);
}
}
and I am instancing it like so:
INSTANCE:
import wrapper from './../../components/wrapper.jsx';
render() {
return (
<wrapper>hi world</wrapper>
);
}
But it is not working. How could I do this?. Thank you.