I want to use the data from props in the helper function as a parameter.
However, I still can't do it, I tried directly
const SuperHero = (props) => {
const [hero, setHero] = useState("");
const searchSuperHero = (props.name) => {}
Also using destructuring props
const SuperHero = (props) => {
const [hero, setHero] = useState("");
const {name} = props.name;
const searchSuperHero = (name) => {}
But I still can't capture the data and it shows the variable as declared but never used even though it is used right in the function below.
Please, Where is problem?
Thank you
searchSuperHero(props.name)make sure the name is coming in the props