|
1 |
| -<!DOCTYPE html> |
2 |
| -<html> |
3 |
| - <head> |
4 |
| - <meta charset="utf-8" /> |
5 |
| - <title>Load with Require.js (AMD)</title> |
6 |
| - </head> |
7 |
| - <body style="padding: 50px"> |
8 |
| - <div id="root"></div> |
| 1 | +<div id="root" style="padding: 50px;"></div> |
9 | 2 |
|
10 |
| - <!-- Require.js --> |
11 |
| - <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"></script> |
| 3 | +<!-- RequireJS --> |
| 4 | +<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script> |
12 | 5 |
|
13 |
| - <script> |
14 |
| - window.requirejs.config({ |
15 |
| - paths: { |
16 |
| - 'html-react-parser': '../dist/html-react-parser.min', |
17 |
| - react: 'https://unpkg.com/react@16/umd/react.production.min', |
18 |
| - 'react-dom': |
19 |
| - 'https://unpkg.com/react-dom@16/umd/react-dom.production.min' |
20 |
| - } |
21 |
| - }); |
| 6 | +<script> |
| 7 | + window.requirejs.config({ |
| 8 | + paths: { |
| 9 | + 'html-react-parser': '../dist/html-react-parser.min', |
| 10 | + react: 'https://unpkg.com/react@16/umd/react.development', |
| 11 | + 'react-dom': 'https://unpkg.com/react-dom@16/umd/react-dom.development' |
| 12 | + } |
| 13 | + }); |
22 | 14 |
|
23 |
| - window.requirejs(['react-dom', 'html-react-parser'], function( |
24 |
| - ReactDOM, |
25 |
| - HTMLReactParser |
26 |
| - ) { |
27 |
| - ReactDOM.render( |
28 |
| - HTMLReactParser( |
29 |
| - '<h2 style="font-family:\'Lucida Grande\';">' + |
30 |
| - 'HTMLReactParser loaded with Require.js' + |
31 |
| - '<\/h2>' |
32 |
| - ), |
33 |
| - document.getElementById('root') |
34 |
| - ); |
35 |
| - }); |
36 |
| - </script> |
37 |
| - </body> |
38 |
| -</html> |
| 15 | + window.requirejs(['html-react-parser', 'react-dom'], function( |
| 16 | + HTMLReactParser, |
| 17 | + ReactDOM |
| 18 | + ) { |
| 19 | + ReactDOM.render( |
| 20 | + HTMLReactParser( |
| 21 | + '<h2 style="font-family:\'Lucida Grande\';">' + |
| 22 | + 'HTMLReactParser loaded with RequireJS' + |
| 23 | + '<\/h2>' |
| 24 | + ), |
| 25 | + document.getElementById('root') |
| 26 | + ); |
| 27 | + }); |
| 28 | +</script> |
0 commit comments