Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specify deps in useEffect and use useCallback for pushEvent #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vonagam
Copy link

@vonagam vonagam commented May 16, 2023

To avoid running calling the effect function on every rerender deps need to be specified. Makes sense to mark liveState as one.

To avoid creating new pushEvent function on each rerender (and potentially cause unneeded rerenders if it is used as a prop or as a dep) useCallback can be used.

Specify type of event argument as a string in pushEvent.

Also looking at published filed seems that build folder is missing but there are useLiveState.ts and tsconfig.json. I think it makes sense to add files field to package.json to prevent exposing unnecessary files.

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.

1 participant