Skip to content

Conversation

drebrez
Copy link

@drebrez drebrez commented Oct 8, 2025

Introduces a useConstructor hook that executes a provided callback only once during the component's lifecycle, similar to a constructor.

This ensures that initialization logic is performed only once, even after re-renders or component remounts. Includes thorough tests to confirm the hook's behavior in different scenarios.

Closes #7

Introduces a `useConstructor` hook that executes a provided callback only once during the component's lifecycle, similar to a constructor.

This ensures that initialization logic is performed only once, even after re-renders or component remounts. Includes thorough tests to confirm the hook's behavior in different scenarios.
Copy link

pkg-pr-new bot commented Oct 8, 2025

Open in StackBlitz

npm i https://pkg.pr.new/neolution-ch/react-utils/@neolution-ch/react-utils@11

commit: 8ce9787

@drebrez drebrez changed the title Adds useConstructor hook Add useConstructor hook Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add useConstructor hook

2 participants