Create a new instance of the Component. Args: children: The children of the component. props: The props of the component. Returns: A new instance of the Component with an independent copy of the State.
(cls, *children, **props)
| 2567 | |
| 2568 | @classmethod |
| 2569 | def create(cls, *children, **props) -> Component: |
| 2570 | """Create a new instance of the Component. |
| 2571 | |
| 2572 | Args: |
| 2573 | children: The children of the component. |
| 2574 | props: The props of the component. |
| 2575 | |
| 2576 | Returns: |
| 2577 | A new instance of the Component with an independent copy of the State. |
| 2578 | """ |
| 2579 | from reflex.compiler.compiler import into_component |
| 2580 | |
| 2581 | cls._per_component_state_instance_count += 1 |
| 2582 | state_cls_name = f"{cls.__name__}_n{cls._per_component_state_instance_count}" |
| 2583 | component_state = type( |
| 2584 | state_cls_name, |
| 2585 | (cls, State), |
| 2586 | {"__module__": reflex.istate.dynamic.__name__}, |
| 2587 | mixin=False, |
| 2588 | ) |
| 2589 | # Save a reference to the dynamic state for pickle/unpickle. |
| 2590 | setattr(reflex.istate.dynamic, state_cls_name, component_state) |
| 2591 | component = component_state.get_component(*children, **props) |
| 2592 | component = into_component(component) |
| 2593 | component.State = component_state |
| 2594 | return component |
| 2595 | |
| 2596 | |
| 2597 | @dataclasses.dataclass( |
nothing calls this directly
no test coverage detected