Skip to content

Cannot combine @react.component and @directive #7257

Closed
@nojaf

Description

@nojaf

Is it expected behavior that @react.component and @directive don't work together?

@react.component
let make = @directive("'use memo'")
(~count, ~username=?) => {
  let times = switch count {
  | 1 => "once"
  | 2 => "twice"
  | n => Belt.Int.toString(n) ++ " times"
  }

  let name = switch username {
  | Some("") => "Anonymous"
  | Some(name) => name
  | None => "Anonymous"
  }

  <div> {React.string(`Hello ${name}, you clicked me ` ++ times)} </div>
}

Repro

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions