preact-habitat | Zero configuration Preact widgets renderer | Frontend Framework library
kandi X-RAY | preact-habitat Summary
kandi X-RAY | preact-habitat Summary
A 900 Bytes module for that will make plugging in Preact components and widgets in any CMS or website as fun as lego!.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize the login module
preact-habitat Key Features
preact-habitat Examples and Code Snippets
Community Discussions
Trending Discussions on preact-habitat
QUESTION
How to expose a function that can render a preact app where I can pass render position and props?
There is no webpack config can be edited in preact, so how to achieve this?
I've seen preact-habitat plugin, the widget can't be rendered by passing props to a function.
For my use case I need to create a bundle.js that contains multiple embeddable widgets and preact source.
I can call renderWidgetA(position, props), renderWidgetB(position, props) to render it to position, also I need to pass different props to the existing rendered widget
Is there any way to achieve this?
This is a similar logic with svelte: How to expose a function in svelte that can accept parameters to render?
Highly appreciate for any feedback.
...ANSWER
Answered 2020-Mar-13 at 14:55Assuming that by position, you mean Mounting HTML element like body
, div
or some CSS selector like '#mountElm'
, then you can export a render function like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install preact-habitat
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page