If you think this question is stupid, sorry for that and please forgive me because iam Beginner.:)
1) I want to declare variables using react hooks i done like this:
const[adata,setAdata]=useState(
name:"",
companyname: ""
})
2)I want to assign " name" to the value(name=filteredperson.name,companyname=filteredperson.companyname) that inside map function here, map function code:
{data.map((filteredPerson, index) => (
<td>{filteredperson.name}</td>
<td>{filteredperson.companyname}</td>
3)Finally,so i assigned my map function values to variables using react hooks, i want to print it on console.
for eg:name:{filteredperson.name} value in console
Note:filteredperson is a map function. I want to assign map values to variables that are using react hooks.
Your data variable is of type {name: string, companyname: string}, so to assign value to this variable, you call the setter function:
setData({name: NAME_VALUE, companyname: COMPANYNAME_VALUE})
After you set the value of this object, you can print the values with:
console.log(data.name)
console.log(data.companyname)