import React , { useState , useEffect } from 'react' ; import { getLocalizedFilePathsFromClasses } from 'services/content' ; import { loadResults } from 'services/results-loader' ; import Markdown from './markdown' ; export interface Props { classes : string [ ] ; } export const Results = ( { classes } ) => { const [ contents , setContents ] = useState < string > ( null ) ; useEffect ( ( ) => { if ( classes ) { const results = getLocalizedFilePathsFromClasses ( classes ) ; console . log ( 'classes' , classes ) ; console . log ( 'results' , results ) ; loadResults ( results ) . then ( setContents ) ; } } , [ classes ] ) ; return contents && < Markdown source = { contents } />; } ; export default Results ;