Pushing overhaul.
This commit is contained in:
30511
web/modules/custom/dc_react/js/dist/main.min.js
vendored
Normal file
30511
web/modules/custom/dc_react/js/dist/main.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
web/modules/custom/dc_react/js/dist/main.min.js.map
vendored
Normal file
1
web/modules/custom/dc_react/js/dist/main.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
7
web/modules/custom/dc_react/js/src/components/Button.js
Normal file
7
web/modules/custom/dc_react/js/src/components/Button.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
function Button(props) {
|
||||
return <button className={"btn btn-" + props.classes}><a href={props.link}>{ props.text }</a></button>;
|
||||
}
|
||||
|
||||
export default Button;
|
||||
16
web/modules/custom/dc_react/js/src/components/Counter.js
Normal file
16
web/modules/custom/dc_react/js/src/components/Counter.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
function Counter() {
|
||||
const [count, setCount] = useState(0);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<p>You clicked {count} times</p>
|
||||
<button onClick={() => setCount(count + 1)}>
|
||||
Click me
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Counter;
|
||||
14
web/modules/custom/dc_react/js/src/index.jsx
Normal file
14
web/modules/custom/dc_react/js/src/index.jsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import React from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import Button from './components/Button';
|
||||
import Counter from './components/Counter';
|
||||
|
||||
const container = document.getElementById('react-block');
|
||||
const root = createRoot(container);
|
||||
|
||||
root.render(
|
||||
<div>
|
||||
<Button text="Click me" link="https://www.drupal.org" classes="primary" />
|
||||
<Counter />
|
||||
</div>
|
||||
);
|
||||
Reference in New Issue
Block a user