Kaynağa Gözat

Add React fragment support (#148)

Kabir Goel 2 yıl önce
ebeveyn
işleme
84ca907aac

+ 1 - 0
pynecone/components/layout/__init__.py

@@ -6,6 +6,7 @@ from .cond import Cond
 from .container import Container
 from .flex import Flex
 from .foreach import Foreach
+from .fragment import Fragment
 from .grid import Grid, GridItem, ResponsiveGrid
 from .html import Html
 from .spacer import Spacer

+ 9 - 0
pynecone/components/layout/fragment.py

@@ -0,0 +1,9 @@
+"""React fragments to enable bare returns of component trees from functions."""
+from pynecone.components.component import Component
+
+
+class Fragment(Component):
+    """A React fragment to return multiple components from a function without wrapping it in a container."""
+
+    library = "react"
+    tag = "Fragment"