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

feat: allow setting an initial theme value via optional useTheme argument #174

Merged
merged 1 commit into from Jul 19, 2022

Conversation

christianblandford
Copy link
Member

useTheme now takes an optional parameter for the initial value. This is useful as it allows hook chaining.

For example, a user could have a hook/function that reads the end-user's preferred theme from storage, and passes it to the useTheme hook.

A rough example:

const storedTheme = useConfig('theme')
const {theme, setTheme} = useTheme(storedTheme)

@netlify
Copy link

netlify bot commented Jul 19, 2022

Deploy Preview for react-daisyui ready!

Name Link
🔨 Latest commit 50f5dec
🔍 Latest deploy log https://app.netlify.com/sites/react-daisyui/deploys/62d731257f27120009172a60
😎 Deploy Preview https://deploy-preview-174--react-daisyui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@christianblandford christianblandford changed the title feat: added ability to set an initial value for the useTheme hook feat: Set an initial theme value via optional useTheme argument Jul 19, 2022
@christianblandford christianblandford changed the title feat: Set an initial theme value via optional useTheme argument feat: allow setting an initial theme value via optional useTheme argument Jul 19, 2022
@benjitrosch benjitrosch merged commit 6b88b49 into main Jul 19, 2022
@benjitrosch benjitrosch deleted the christian/theme-initial-value branch July 19, 2022 23:35
This was referenced Jul 19, 2022
This was referenced Aug 16, 2022
This was referenced Sep 5, 2022
This was referenced Oct 31, 2022
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.

None yet

2 participants