for example, there is a string such as abcd {1} efadf,
is there a way to replace {1} with a component, and then render the result after replacement?
Thank you!
for example, there is a string such as abcd {1} efadf,
is there a way to replace {1} with a component, and then render the result after replacement?
Thank you!
wrote a demo
https://codepen.io/mugou/pen/.
you can do this by dividing the string into arrays, replacing the corresponding with components of React, and then rendering:
<h1>Hello CodeSandbox</h1>
<h2>Start editing to see some magic happen!</h2>
<div>{segs}</div>
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
Previous: The Table of ant design is not updated after the data source changes.
Next: Vue hangs a function in prototype, calling return is always undefined