This is an example repository that shows how to use StencilJS components within UXPin Merge.
It utilises the wrapper method of integrating UXPin and wraps StencilJS built components.
packages
components
- StencilJS built componentscomponents-uxpin
- UXPin wrappers for thecomponents
packagereact-friendly-custom-elements
- contains a hook calleduseCustomElement
for using custom elements inReact
lerna.json
- configuration of lerna monorepo
yarn install && yarn start:uxpin
- this will install all dependencies, build components
package and start UXPin merge in experimental mode
yarn build:stencil
- will build thecomponents
packageyarn start:stencil
- will start Stencil development serveryarn start:uxpin
- will start UXPin merge in expirmental mode (also runyarn build:stencil
)
Each UXPin component has a unique key applied at run time to ensure that you do not need to re-load the page every time a property is updated. Due to the nature of web components and slot content, React will throw an error when the content changes.
Web components use slots to position and style it's content. Each component has a slot
property so components can be nested into a parent component's slot.
Each UXPin wrapper uses useCustomElement
hook. This hook, inspired by the original useCustomElement hook, bridges the gap between custom elements and react. For example, it will assign event callbacks to listeners and stringify objects for use by custom elements.