Skip to content

Bug: eslint-plugin-react-hooks does not allow passing hook as props in jsx syntax #24108

Closed as not planned
@alisajadih

Description

@alisajadih

React version: latest
demo:https://codesandbox.io/s/cranky-framework-p7r5vb?file=/src/App.tsx

The current behavior

jsx syntax does not work correctly.

 <>
    <IsolateRender useRender={() => useCustomeHook()} /> // error !
    <IsolateRender {...{ useRender: () => useCustomeHook() }} /> no error!
 </>

it shows this error:

React Hook "useCustomeHook" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function. (react-hooks/rules-of-hooks)

The expected behavior

jsx syntax should work as object syntax.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: StaleAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions