// @flow
import React from 'react'

module.exports = (options: any) =>
  React.createClass({
    displayName: 'GoogleFont',

    render () {
      // Create family + styles string
      let fontsStr = ''
      if (options.googleFonts) {
        const fonts = options.googleFonts.map((font) => {
          let str = ''
          str += font.name.split(' ').join('+')
          str += ':'
          str += font.styles.join(',')

          return str
        })

        fontsStr = fonts.join('|')

        if (fontsStr) {
          return React.DOM.link({
            href: `//fonts.googleapis.com/css?family=${fontsStr}`,
            rel: 'stylesheet',
            type: 'text/css',
          })
        } else {
          return null
        }
      } else {
        return null
      }
    },
  })


// @flow
import React from 'react'

module.exports = (options: any) =>
  React.createClass({
    displayName: 'GoogleFont',

    render () {
      // Create family + styles string
      let fontsStr = ''
      const fonts = options.googleFonts.map((font) => {
        let str = ''
        str += font.name.split(' ').join('+')
        str += ':'
        str += font.styles.join(',')

        return str
      })

      fontsStr = fonts.join('|')

      if (fontsStr) {
        return React.DOM.link({
          href: `//fonts.googleapis.com/css?family=${fontsStr}`,
          rel: 'stylesheet',
          type: 'text/css',
        })
      } else {
        return null
      }
    },
  })


--- 
+++ 
@@ -8,27 +8,23 @@
     render () {
       // Create family + styles string
       let fontsStr = ''
-      if (options.googleFonts) {
-        const fonts = options.googleFonts.map((font) => {
-          let str = ''
-          str += font.name.split(' ').join('+')
-          str += ':'
-          str += font.styles.join(',')
+      const fonts = options.googleFonts.map((font) => {
+        let str = ''
+        str += font.name.split(' ').join('+')
+        str += ':'
+        str += font.styles.join(',')
 
-          return str
+        return str
+      })
+
+      fontsStr = fonts.join('|')
+
+      if (fontsStr) {
+        return React.DOM.link({
+          href: `//fonts.googleapis.com/css?family=${fontsStr}`,
+          rel: 'stylesheet',
+          type: 'text/css',
         })
-
-        fontsStr = fonts.join('|')
-
-        if (fontsStr) {
-          return React.DOM.link({
-            href: `//fonts.googleapis.com/css?family=${fontsStr}`,
-            rel: 'stylesheet',
-            type: 'text/css',
-          })
-        } else {
-          return null
-        }
       } else {
         return null
       }
Check that options declares Google Fonts before building component
