@jlpereira/taxonpages-plugin-react
v0.0.1
Published
A TaxonPages plugin for integrating React components
Downloads
71
Readme
TaxonPages React Plugin
A TaxonPages plugin that enables the use of React components inside a Vue-based TaxonPages site. It provides a VReactBridge component that mounts and manages React component lifecycles within Vue templates.
Installation
Via npm
npm install @jlpereira/taxonpages-plugin-reactManual
Copy the react/ folder into your project's plugins/ directory:
plugins/
react/Usage
Once installed, the plugin registers a global VReactBridge Vue component. Use it to render any React component:
<template>
<VReactBridge :component="MyReactComponent" :props="{ title: 'Hello' }" />
</template>
<script setup>
import MyReactComponent from './MyReactComponent.jsx'
</script>Props
| Prop | Type | Required | Description |
| ----------- | ----------------- | -------- | ---------------------------------------- |
| component | Object / Function | Yes | The React component to render |
| props | Object | No | Props to pass to the React component |
How it works
Plugin registration — The plugin entry point (
plugin.js) hooks into the TaxonPages build system. ThevueSetup.jsfile registersVReactBridgeas a global Vue component.Mounting — When
VReactBridgemounts, it creates a React root viacreateRooton a container<div>and renders the provided React component.Reactivity — The bridge watches the
componentandpropsfor changes and re-renders the React tree when they update.Cleanup — On unmount, the React root is properly destroyed to prevent memory leaks.
Project structure
react/
├── plugin.js # Plugin entry point (Vite/build config)
├── vueSetup.js # Registers VReactBridge as a global component
├── package.json
└── components/
└── VReactBridge.vue # Vue wrapper that mounts React componentsLicense
MIT
