我正在基于变量加载渲染两个 Chakra UI 组件:
{loading ? (<Spinner>) : (<Text color={useColorModeValue('gray.800', 'gray.400')>Hi</Text) }
Run Code Online (Sandbox Code Playgroud)
但 IDE 警告我这一点:
ESLint: React Hook "useColorModeValue" is called conditionally. React Hooks must be called in the exact same order in every component render.
我应该如何渲染这些组件?useColorModeValue 是一个钩子