diff --git a/src/modules/Status.js b/src/modules/Status.js index 1d5ad99..612f125 100644 --- a/src/modules/Status.js +++ b/src/modules/Status.js @@ -14,7 +14,7 @@ type StatusPropsType = { code?: string | number, }; type StatusContextType = { - router: { + router?: { staticContext: { setCode: (code: number) => void, }, @@ -23,9 +23,7 @@ type StatusContextType = { export class Status extends React.Component { constructor(props: StatusPropsType, context: StatusContextType) { super(props, context); - const { - router: {staticContext}, - } = context; + const {router: {staticContext} = {}} = context; if (staticContext && staticContext.setCode) { staticContext.setCode(parseInt(this.props.code, 10)); }