✨ Announcing our seed funding led by Lux Capital! Read more about it on our blog

Search documentation...




[ Learn ]

[ Concepts ]

[ Reference ]


By default, Reflex will re-render the entire page every time the state changes. This is fine for small apps, but can be slow for larger apps.
You can prevent unnecessary rendering by memoizing components, which can greatly improve your app's performance. Just add the @rx.memo decorator to a component function to make it memoized, and list its props as arguments.
The memoized component can be used like any other component. Use keyword arguments to pass in the component's props.

This Heading Won't Rerender

def fixed_header(text: str) -> rx.Component:
    """A fixed header that doesn't change when the state changes."""
    return rx.heading(text)

def index():
    return fixed_header(text="This Heading Won't Rerender")
← Custom VarsWrapping React →

Copyright © 2023 Pynecone, Inc.