Answer the question
In order to leave comments, you need to log in
How to solve props error on duplicate component?
Good afternoon!
Faced a problem when transferring props. There is a parent component Parent which receives callback'om function setValue from Child.
import React, { useState } from "react";
const Parent = () => {
const [value, setValue] = useState([]);
console.log(value);
return (
<Child setValue={setValue} name={name1} title={title1} />
{/* <Child setValue={setValue} name={name2} title={title2} /> */}
);
};
Answer the question
In order to leave comments, you need to log in
Or maybe you somehow have a function called in both child at once?
Otherwise, it should work fine, the function is created in the Parent, the Child just calls it via the prop
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question