app.tsx
16 lines
| 1 | import {createRoot} from '@wordpress/element'; |
| 2 | import CampaignComments from './shared/components/CampaignComments'; |
| 3 | |
| 4 | const roots = document.querySelectorAll('[data-givewp-campaign-comments]'); |
| 5 | |
| 6 | if (roots) { |
| 7 | roots.forEach((root) => { |
| 8 | const attributes = root.getAttribute('data-attributes'); |
| 9 | const secondaryColor = root.getAttribute('data-secondary-color'); |
| 10 | |
| 11 | return createRoot(root).render( |
| 12 | <CampaignComments attributes={JSON.parse(attributes)} secondaryColor={secondaryColor} /> |
| 13 | ); |
| 14 | }); |
| 15 | } |
| 16 |