-
Notifications
You must be signed in to change notification settings - Fork 953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
about use rx.memo with children #3279
Comments
@seewindcn The memo component was a bit hacky and needs to be documented better for sure. For your use case, the following code works for me: import reflex as rx
@rx.memo
def layout1(children: rx.Component) -> rx.Component:
return rx.container(
rx.heading("heading"),
children,
)
def index():
"""The main view."""
return layout1(
rx.box("hi")
)
app = rx.App()
app.add_page(index) How are you passing in the children? Since it's a special prop, you should just pass it as a child like in normal reflex components, you don't have to specify the keyword argument. For the styling - if you can create an issue for that, I think it's something we should be able to add. |
yes, the code works; my question is about the index.js which generate from python:
"<Layout1 children=" this children prop is useless, and maybe very very long. it may js file's size bigger. |
@seewindcn Got it - I think this is just a bug in our memo, we should be recognizing |
Describe the bug
I am trying use memo for website's layout, like this:
it work; but the js like below:
my question is:
Specifics (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: