/* I take only the important part of code */
Parent: */Here I create logic for my function */ `
const [allNoc,setAllNoc] = useState(0);
const allNocFunc = value => {
console.log(value);
setAllNoc(value);
};`
*/In return I have my component with props */
<SellectAllNoc dataList={resultDataList} allNocFunc={allNocFunc} />
Child:
function SellectAllNoc(dataList,allNocFunc) {const handleChange = () => {allNocFunc(2);};
I want to sent value from child to parent by callback function
If "Child" is meant to be a React component, this is not how you destructure props:
function SellectAllNoc(dataList,allNocFunc) {
This is:
function SellectAllNoc({ dataList, allNocFunc }) {
Basically, all of the props are passed to the component as a single object, with the prop keys/values being the properties on that object. So in your code the dataList variable has two properties on it, called dataList and allNocFunc. And in your code the allNocFunc variable isn't a function. (I actually don't know if components receive a second argument in React, I've never used one. So it may be undefined, or may be some unexpected value.)