KyleAMathews / typography.js

A powerful toolkit for building websites with beautiful design
http://kyleamathews.github.io/typography.js/
MIT License
3.84k stars 182 forks source link

react-typography CSS rendering in style as [object Object] #171

Closed sethlesky closed 6 years ago

sethlesky commented 6 years ago

I'm adding Typography.js to a React project with the following import:

import { TypographyStyle, GoogleFont } from 'react-typography
import theme from 'typography-theme-stern-grove''

Within my React component:

<head>
  <TypographyStyle typography={theme} />
</head>

Yet, I'm getting the following once the document renders in the browser <style id="typography.js">[object Object]</style>

sethlesky commented 6 years ago

The issue was that I needed to pass the theme to the Typography function instead of using it directly like so:

const theme = new Typography(groveTheme)