-
-
Notifications
You must be signed in to change notification settings - Fork 126
/
requirejs.html
36 lines (33 loc) 路 1.17 KB
/
requirejs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Load with Require.js (AMD)</title>
</head>
<body style="padding: 50px">
<div id="root"></div>
<!-- Require.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.min.js"></script>
<script>
requirejs.config({
paths: {
'html-react-parser': '../dist/html-react-parser.min',
'react': 'https://unpkg.com/react@latest/dist/react.min',
'react-dom': 'https://unpkg.com/react-dom@latest/dist/react-dom.min'
}
});
requirejs([
'react-dom', 'html-react-parser'
], function(ReactDOM, HTMLReactParser) {
ReactDOM.render(
HTMLReactParser(
'<h2 style="font-family:\'Lucida Grande\';">' +
'HTMLReactParser loaded with Require.js' +
'<\/h2>'
),
document.getElementById('root')
);
});
</script>
</body>
</html>