I've got a functional component which need to render a child component (functional too) and an html string sibling to him in the same node.
Following this piece of code:
const html = 'My<br>Value';
const ResponsiveLabel = render('span', { class: 'responsive-label' }, 'MyLabel:');
return render('div', { class: 'ui-cell' }, [ ResponsiveLabel, html ]);
It should render this html code:
<div class="ui-cell">
<span class="responsive-label">MyLabel:</span>
My<br>Value
</div>
In this case, My<br>Value will just be interpreted as text, <br> will be visible.
My goal is to render the ResponsiveLabel and const html as html.
To do it with CreateElement function, we have to use the prop. domProps like this:
render('any', { domProps: { innerHTML: html } });
Which will result as a well interpreted html string, and <br> will make a carriage return.
But i don't know how to render this html with ResponsiveLabel before...
I can't do that
const html = render(undefined, { domProps: { innerHTML: 'My<br>Value' } });
const ResponsiveLabel = render('span', { class: 'responsive-label' }, 'MyLabel:');
return render('div', { class: 'ui-cell' }, [ ResponsiveLabel, html ]);
Or even:
const ResponsiveLabel = render('span', { class: 'responsive-label' }, 'MyLabel:');
return render('div', {
class: 'ui-cell',
domProps: { innerHTML: 'My<br>Value' }
}, [ ResponsiveLabel ]);
How can i reach my goal ?
EDIT: it seems not possible. If we use render function, we have to use a tag. So I need to use one for my html string.