import * as React from "react" ; import CodeArea from "../CodeArea" ; import watchCode from "./codeExamples/watchCode" ; import watchCodeTs from "./codeExamples/watchCodeTs" ; import generic from "../../data/generic" ; import * as typographyStyles from "../../styles/typography.module.css" ; import * as tableStyles from "../../styles/table.module.css" ; export default function ApiWatch ( { currentLanguage , api , } ) { return ( < > < code className = { typographyStyles . codeHeading } > < h2 > watch : { " " } < span className = { typographyStyles . typeText } > { `(names?: string | string[] | { nest : boolean }) =&gt; any` } < /span> < /h2> < /code> { api . watch . description } < div className = { tableStyles . tableWrapper } > < table className = { tableStyles . table } > < tbody > < tr > < th style = { { minWidth : 180 , } } > { generic . type [ currentLanguage ] } < /th> < th style = { { minWidth : 200 , } } > { generic . description [ currentLanguage ] } < /th> < th > { generic . example [ currentLanguage ] } < /th> < th style = { { minWidth : 250 , } } > { generic . return [ currentLanguage ] } < /th> < /tr> < tr > < td > < code className = { typographyStyles . typeText } > string < /code> < /td> < td > { api . watch . tableTitle . single } < /td> < td > < code > watch ( 'inputName' ) < /code> < br / > < code > watch ( 'inputName' , 'value' ) < /code> < /td> < td > < code className = { typographyStyles . typeText } > { `string | string[] | { [key:string] : any } | undefined` } < /code> < /td> < /tr> < tr > < td > < code className = { typographyStyles . typeText } > { `string[]` } < /code> < /td> < td > { api . watch . tableTitle . multiple } < /td> < td > < code > watch ( [ 'inputName1' ] ) < /code> < br / > < code > { `watch(['field1'], { field1: '1' })` } < /code> < /td> < td > < code className = { typographyStyles . typeText } > { `{ [key:string] : any }` } < /code> < /td> < /tr> < tr > < td > < code className = { typographyStyles . typeText } > undefined < /code> < /td> < td > { api . watch . tableTitle . all } < /td> < td > < code > watch ( ) < /code> < br / > < code > { `watch(undefined, { field: 'value1' })` } < /code> < /td> < td > < code className = { typographyStyles . typeText } > { `{ [key:string] : any }` } < /code> < /td> < /tr> < /tbody> < /table> < /div> < CodeArea rawData = { watchCode } tsRawData = { watchCodeTs } url = "https://codesandbox.io/s/pp1l40q7wx" / > < hr /> < />); }