Skip to content

feat(core): add sideEffects flag and enhance useContext functionality#568

Merged
productdevbook merged 2 commits intomainfrom
feat-context-default-value
Nov 18, 2024
Merged

feat(core): add sideEffects flag and enhance useContext functionality#568
productdevbook merged 2 commits intomainfrom
feat-context-default-value

Conversation

@productdevbook
Copy link
Copy Markdown
Contributor

This pull request includes changes to the packages/core module to improve the handling of side effects and enhance the createContext function. The most important changes are detailed below:

Handling of side effects:

  • packages/core/package.json: Added "sideEffects": false to the package configuration to indicate that the module does not have side effects, which can help with tree-shaking during the build process.

Enhancements to createContext function:

  • packages/core/src/hooks/createContext.ts: Modified the useContext function to accept an optional value parameter. This allows the function to use the provided value or fall back to the default value if none is provided. Additionally, the function now returns null explicitly if the state is null.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 17, 2024

Thank you for following the naming conventions! 🙏

@productdevbook
Copy link
Copy Markdown
Contributor Author

@teleskop150750 pr can you check again

@productdevbook productdevbook merged commit 5bfc675 into main Nov 18, 2024
@productdevbook productdevbook deleted the feat-context-default-value branch November 18, 2024 05:29
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.

2 participants