Created
March 17, 2019 11:17
-
-
Save bussiere/85cee7851d12ed5fa04e9a503ea56e4f to your computer and use it in GitHub Desktop.
ONlick Problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import { any } from 'prop-types'; | |
function handleClick(this:any,name:React.ReactNode) { | |
console.log('The link was clicked.'); | |
this.props.callbackFromParentSearch(name); | |
} | |
export const Suggestions = (props:any) => { | |
const options = props.results.map((r: { id: React.Key; name: React.ReactNode; }) => ( | |
<a href="#" onClick={handleClick(r.name)}> | |
<li key={r.id}> | |
{r.name} | |
</li> | |
</a> | |
)) | |
return <ul>{options}</ul> | |
} | |
export default Suggestions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment