Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions modules/pdb_react/components/react_example_1/react-example-1.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
ReactDOM.render(React.createElement(
'h1',
null,
'Hello, world!'
), document.getElementById('react-example-1'));
// The code was taken from https://reactjs.org/docs/components-and-props.html
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}

const element = <Welcome name="Sara" />;

ReactDOM.render(
element,
document.getElementById('root')
);
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ module_status: active
presentation: react
add_js:
footer:
'react-example-1.js': {}
'react-example-1.js': { preprocess: 0, attributes: { type: text/babel } }

5 changes: 3 additions & 2 deletions modules/pdb_react/pdb_react.libraries.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
react:
version: VERSION
js:
//cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react.min.js: {type: external, minified: true}
//cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-dom.min.js: {type: external, minified: true}
//unpkg.com/react@16/umd/react.production.min.js: {type: external, minified: true}
//unpkg.com/react-dom@16/umd/react-dom.production.min.js: {type: external, minified: true}
//unpkg.com/@babel/standalone/babel.min.js: {type: external, minified: true}
dependencies:
- core/drupal
- core/drupalSettings