import { AppContextConsumerWrapper, } from '../AppContextConsumerWrapper'; import { IVariableProps, } from './IVariableProps'; import * as React from 'react'; import { Print } from '../Print'; export const Variable: React.FunctionComponent = ({ name, doError, }) => ( {({ store: { getState } }) => { const { history: { present: { storyState }, }, } = getState(); if (!(name in storyState)) { if (!doError) { return null; } throw new Error( `The key ${name} did not exist in the present story state.` ); } return ( {storyState[name]} ); }} );