react-use-theme
React Hook for consume Styled Component theme
Install
yarn add react-use-theme
How to use it?
Get any attribute from theme in React Components
const myColor =
Example
import React from 'react'import styled ThemeProvider from 'styled-components'import useTheme from 'react-use-theme' const theme = colors: myCustomColor: '#07c' // You have to provide a Context themeconst App = return <ThemeProvider => <MyComponent /> </ThemeProvider> // then you can access to theme with useTheme hookconst MyComponent = const titleColor = // you can pass default values const defaultColor = 'red' const subtitleColor = return <div> <Title =>Hello World</Title> </div> const Title = styledh1` color: ;`