Skip to content

Commit 36f1272

Browse files
refactor(examples): rename amd/requirejs.html to requirejs/index.html
1 parent 47d89ef commit 36f1272

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed

examples/amd/requirejs.html

Lines changed: 0 additions & 27 deletions
This file was deleted.

examples/requirejs/index.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<div id="root" style="padding: 50px"></div>
2+
3+
<script
4+
src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"
5+
integrity="sha512-c3Nl8+7g4LMSTdrm621y7kf9v3SDPnhxLNhcjFJbKECVnmZHTdo+IRO05sNLTH/D3vA6u1X32ehoLC7WFVdheg=="
6+
crossorigin="anonymous"
7+
referrerpolicy="no-referrer"
8+
></script>
9+
10+
<script>
11+
requirejs.config({
12+
paths: {
13+
'html-react-parser': '../../dist/html-react-parser.min',
14+
react: 'https://unpkg.com/react@18/umd/react.development',
15+
'react-dom': 'https://unpkg.com/react-dom@18/umd/react-dom.development'
16+
}
17+
});
18+
19+
requirejs(['html-react-parser', 'react-dom'], (HTMLReactParser, ReactDOM) => {
20+
const root = ReactDOM.createRoot(document.getElementById('root'));
21+
22+
root.render(
23+
HTMLReactParser(`
24+
<h2 style="font-family: 'Lucida Grande', sans-serif;">
25+
HTMLReactParser loaded with RequireJS
26+
</h2>'
27+
`)
28+
);
29+
});
30+
</script>

0 commit comments

Comments
 (0)