Using 'children' as a slot results in errors

Created on 27 February 2025, about 1 month ago

Overview

I used "children" as a name for a slot following the React practice of defining the only slot of a component. This results in bunch of different errors:

Proposed resolution

User interface changes

๐Ÿ› Bug report
Status

Active

Version

0.0

Component

Theme builder

Created by

๐Ÿ‡ซ๐Ÿ‡ฎFinland lauriii Finland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @lauriii
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sanket.tale

    Hi @lauriii

    In React, "children" is a reserved prop that automatically holds any nested content. When you reuse it as a slot name in Experience Builder, it can conflict with Reactโ€™s builtโ€‘in handling and lead to unexpected undefined values.
    I think To fix this, rename the slot name.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia meghasharma

    Yes, children is a reserved prop in React, and using it as a slot name in Experience Builder is causing conflicts.
    I am exploring this issue and trying to understand the best way to fix it. If anyone has suggestions on the correct approach for renaming the slot, I would like to learn more.

  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland lauriii Finland

    I'm wondering if we could allow using children as a slot similar way to how it's allowed in React? We could have special behavior attached to it so that instead of showing the slot in the layers panel, the children would appear as direct children of the parent.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Tagging per #4 + #5.

Production build 0.71.5 2024