I am working on a React component using Typescript. Currently I have the following....
const NameFormatter = React.createClass({
render() {
return (
<div>
<div className="dataset-name">
{this.props.value}
</div>
</div>
);
}
});
This works and outputs
<div>
<div className="dataset-name"> My Value </div>
</div>
What I need though is...
<div fxLayout="row" fxFlex>
<div className="dataset-name"> My Value </div>
</div>
So I tried...
const NameFormatter = React.createClass({
render() {
return (
<div fxFlex fxLayout="row">
<div className="dataset-name">
{this.props.value}
</div>
</div>
);
}
});
But this will not compile and says...
Property 'fxFlex' does not exist on type 'HTMLProps'. Property 'fxLayout' does not exist on type 'HTMLProps'.
How do I go about adding these attributes?
Update
This works...
<div {...{"data-fxFlex":""}}>
The problem is since this is being consumed by angular after rendering and angular requires the name to be fxFlex it doesn't seem to help.
Also this kinda seems to work but doesn't set the value properly...
let d = `
<div className="dataset-name" fxFlex=""> {this.props.value} </div>
`;
return (
<div className="dataset-name-wrapper" dangerouslySetInnerHTML={{__html: d}} > </div>
);
But this outputs
<div class="dataset-name-wrapper">
<div classname="dataset-name" fxflex>
{this.props.value}
</div>
</div>