8000 Function binding only passes the first argument · Issue #91 · effector/reflect · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Function binding only passes the first argument #91
Closed
@wise-danya

Description

@wise-danya

Description

I'm encountering a situation where using reflect to bind a function with multiple arguments only seems to pass the first argument. I'd like to clarify if this is the intended behaviour.

Current Implementation

import { reflect } from "@effector/reflect"

const View = ({ onClick }: { onClick: (first: string, second: number, third: boolean) => void }) => (
  <button onClick={() => onClick("first", 1, true)}>Test</button>
)

const Demo = reflect({
  view: View,
  bind: {
    onClick: (first, second, third) => {
      console.log("onClick", first, second, third)
      // Logs: "onClick", "first", undefined, undefined
    },
  },
})

Current Behaviour

When calling the bound function with multiple arguments, only the first argument is received:

onClick "first" undefined undefined

Additional Context

  • @effector/reflect: 9.2.0
  • effector: 23.2.3
  • effector-react: 23.2.1
  • react: 18

Question

Is this the expected behavior for binding functions with multiple arguments?
Any clarification would be greatly appreciated. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0