You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys, cool project! I'm trying to migrate a basic Chakra + FastAPI app to Pynecone but a bit stuck on implementing the classic Chakra ColorModeSwitcher component.
Is there any way currently to access the color mode hooks? I imagine there are use cases beyond these hooks, but being able to use hooks from other libraries.
Example component to implement:
import*asReactfrom"react"import{useColorMode,useColorModeValue,IconButton,IconButtonProps,}from"@chakra-ui/react"import{FaMoon,FaSun}from"react-icons/fa"typeColorModeSwitcherProps=Omit<IconButtonProps,"aria-label">exportconstColorModeSwitcher: React.FC<ColorModeSwitcherProps>=(props)=>{const{ toggleColorMode }=useColorMode()consttext=useColorModeValue("dark","light")constSwitchIcon=useColorModeValue(FaMoon,FaSun)return(<IconButtonsize="md"fontSize="lg"variant="ghost"color="current"marginLeft="2"onClick={toggleColorMode}icon={<SwitchIcon/>}aria-label={`Switch to ${text} mode`}{...props}/>)}
The text was updated successfully, but these errors were encountered:
Currently there's no good way to use your own React hooks in Pynecone. But this is a feature we want to add because like you said, there are other libraries that use hooks for functionality.
This change requires some core updates to the compiler, so may be a bit more involved. But we will add it to our roadmap.
picklelo
changed the title
Add support for Chakra color mode
Add support for React hooks
Dec 10, 2022
Hi guys, cool project! I'm trying to migrate a basic Chakra + FastAPI app to Pynecone but a bit stuck on implementing the classic Chakra ColorModeSwitcher component.
Is there any way currently to access the color mode hooks? I imagine there are use cases beyond these hooks, but being able to use hooks from other libraries.
Example component to implement:
The text was updated successfully, but these errors were encountered: