Skip to content

How to pass functions as props like react? #1067

@pat0026

Description

@pat0026

Question

I'm trying to explore hooks in dioxus. I'm currently curious about how to use use_memo and use_callback, but I'm having trouble passing a function or closure in the component's properties. Do you have any documentation or example on using these hooks properly in different components or creating component props that pass functions/closures or function pointers?

I don't know how to create functions as members of structs but I tried following these instructions in Stackoverflow. Sadly to say I couldn't compile it. Please see this link as a reference. Any advice would be appreciated.

Environment:

  • Dioxus version: 0.3.2
  • Rust version: 1.69
  • OS info :windows
  • App platform: web

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions