Page MenuHomec4science

ResultCard.js
No OneTemporary

File Metadata

Created
Wed, Nov 13, 02:43

ResultCard.js

import React, {useState} from "react"
import { makeStyles } from '@material-ui/core/styles';
import TermCard from "../components/TermCard"
function ResultCard({result}) {
console.log(result)
const condition = result.map(i=>(
i.condition_type.id
))
//create distinct array
const distinctCondi = Array.from(new Set(condition))
const showDistinct = distinctCondi.map(i =>(
<div>
<h1>{i}</h1>
</div>
))
console.log(`condition : ${condition}`)
console.log(`Distinct condition : ${distinctCondi}`)
// const term = result.map(i=>(
// i.term.map( term => (
// <TermCard key={term.id} term={term}/>
// ))
// ))
function term() {
const termVersion = result.map(i=>(
i.term.map( i => (
i.version.map( j =>(
j.description
))
))
))
const termItem = result.map(i=>(
i.term.map( term => (
<TermCard key={term.id} term={term} version={termVersion}/>
))
))
return (
<>
{termItem}
</>
)
console.log(termVersion)
}
return (
<div key={result.id}>
{term()}
</div>
)
}
export default ResultCard

Event Timeline