[REF-2303] Update custom component template for new API (#3007)
This commit is contained in:
parent
0619017626
commit
ef5c5bea2b
@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
import reflex as rx
|
import reflex as rx
|
||||||
|
|
||||||
# Some libraries you may want to wrap may require dynamic imports.
|
# Some libraries you want to wrap may require dynamic imports.
|
||||||
# This is because they they may not be compatible with Server-Side Rendering (SSR).
|
# This is because they they may not be compatible with Server-Side Rendering (SSR).
|
||||||
# To handle this in Reflex all you need to do is subclass NoSSRComponent instead.
|
# To handle this in Reflex, all you need to do is subclass `NoSSRComponent` instead.
|
||||||
# For example:
|
# For example:
|
||||||
# from reflex.components.component import NoSSRComponent
|
# from reflex.components.component import NoSSRComponent
|
||||||
# class {{ component_class_name }}(NoSSRComponent):
|
# class {{ component_class_name }}(NoSSRComponent):
|
||||||
@ -42,12 +42,12 @@ class {{ component_class_name }}(rx.Component):
|
|||||||
# In this case you can use the lib_dependencies property to specify other libraries to install.
|
# In this case you can use the lib_dependencies property to specify other libraries to install.
|
||||||
# lib_dependencies: list[str] = []
|
# lib_dependencies: list[str] = []
|
||||||
|
|
||||||
# Event triggers, I did not understand the wording of the doc.
|
# Event triggers declaration if any.
|
||||||
# def get_event_triggers(self) -> dict[str, Any]:
|
# Below is equivalent to merging `{ "on_change": lambda e: [e] }`
|
||||||
# return {
|
# onto the default event triggers of parent/base Component.
|
||||||
# **super().get_event_triggers(),
|
# The function defined for the `on_change` trigger maps event for the javascript
|
||||||
# "on_change": lambda e0: [e0],
|
# trigger to what will be passed to the backend event handler function.
|
||||||
# }
|
# on_change: rx.EventHandler[lambda e: [e]]
|
||||||
|
|
||||||
# To add custom code to your component
|
# To add custom code to your component
|
||||||
# def _get_custom_code(self) -> str:
|
# def _get_custom_code(self) -> str:
|
||||||
|
Loading…
Reference in New Issue
Block a user