Is embedding components dynamically possible? #101
mpeterdev
started this conversation in
Implementation
Replies: 1 comment 2 replies
-
Looks feasible to me. When rendering Components with data that potentially embeds other Components, we can parse them out during serialization. Since the Component would be dynamically loaded, they would always be sandboxed. Normally this would require a unique identifier, but since the embedding text is static we can generate those when parsing. So given a Component that embeds content: <div>
embedded [EMBED](ex.near/widget/Badge) Component!
</div> This would currently be serialized as: {
type: "div",
props: {
children: ["embedded [EMBED](ex.near/widget/Badge) Component!"],
},
componentChildren: [],
} Which is not far off from what it would take to embed the Component currently: {
type: "div",
props: {
children: [
"embedded ",
// the `-0` is appended to make the ID unique based on index within content
{ type: "div", props: { id: "dom-ex.near/widget/Badge-0" } },
" Component!",
],
},
componentChildren: ["ex.near/widget/Badge"],
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Near Social has a beta feature for embedding components in posts, here is the announcement message
(post)
@andy-haynes would this be possible under the current architecture of BWE? If not, do you see blockers towards implementing it?
@thisisjoshford if this proves challenging, we need to identify the priority of supporting this. Here is a relevant section from Eugene's pinned post from last year on the future of Near Social
Beta Was this translation helpful? Give feedback.
All reactions