const React = require('react'); const createClass = require('create-react-class'); const _ = require('lodash'); const cx = require('classnames'); const DISMISS_KEY = 'dismiss_render_warning'; const RenderWarnings = createClass({ getInitialState : function() { return { warnings : {} }; }, componentDidMount : function() { this.checkWarnings(); window.addEventListener('resize', this.checkWarnings); }, componentWillUnmount : function() { window.removeEventListener('resize', this.checkWarnings); }, warnings : { chrome : function(){ const isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); if(!isChrome){ return
  • Built for Chrome
    Other browsers do not support   key features this site uses.
  • ; } }, }, checkWarnings : function(){ const hideDismiss = localStorage.getItem(DISMISS_KEY); if(hideDismiss) return this.setState({ warnings: {} }); this.setState({ warnings : _.reduce(this.warnings, (r, fn, type)=>{ const element = fn(); if(element) r[type] = element; return r; }, {}) }); }, dismiss : function(){ localStorage.setItem(DISMISS_KEY, true); this.checkWarnings(); }, render : function(){ if(_.isEmpty(this.state.warnings)) return null; return

    Render Warnings

    If this homebrew is rendering badly if might be because of the following:
      {_.values(this.state.warnings)}
    ; } }); module.exports = RenderWarnings;