// @flow import * as React from 'react'; import { observer } from 'mobx-react'; import Fade from 'components/Fade'; import Subheading from 'components/Subheading'; import DocumentsStore from 'stores/DocumentsStore'; import Document from 'models/Document'; import Backlink from './Backlink'; type Props = { document: Document, documents: DocumentsStore, }; @observer class Backlinks extends React.Component { componentDidMount() { this.props.documents.fetchBacklinks(this.props.document.id); } render() { const { documents, document } = this.props; const backlinks = documents.getBacklinedDocuments(document.id); const showBacklinks = !!backlinks.length; return ( showBacklinks && ( Referenced By {backlinks.map(backlinkedDocument => ( ))} ) ); } } export default Backlinks;