'Replace string inside the props
The following component:
import React from 'react';
const container = ({ items }) => (
<div
dangerouslySetInnerHTML={{
__html: items,
}}
/>
);
export default container;
returns:
<div classname="myDiv"></div>
I'm trying to replace classname with class, but not sure how to do so.
I tried different ways for example this without any success:
<div
dangerouslySetInnerHTML={{
__html: items.replace('classname', 'class')
}}
/>
How can I replace the string inside the props?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
