Dispatched undefined action (только при использовании redux hooks, и пробрасывание их через пропкс компоненту))

  const NewsContainer = () => {
    const [post,getPosts] = useState([]);
    const store  = useSelector(store => store);
    const dispatch = useDispatch(); 


    const searchByInputValue=  useCallback(
        () =>  dispatch(serachByInputValue())
    )
    return (
        <MainPageNews 

        searchByInputValue={searchByInputValue}

        posts={post} />
    );
}


// component 
const News = React.memo(({posts,searchByInputValue1,value}) => {
return (
<div className="news__filter">
                        <div className="news__filter_height"></div>
                        <div className="news__filter_lowest"></div>
                        <input type="text" 
                        className="news__filter_input-search"

                        onChange={e => searchByInputValue(e.target.value)}
                        value={value}
                        />
                    </div>
   );
}

//redux 

//action

export const serachByInputValue = (value) => {
  return{
    type: 'SEARCH_BY_INPUT_VALUE',
    payload:value
  }
};


const initialState = {
    inputValue:""
  };

  export default (state = initialState, action) => {
  console.log("TCL: action", action)
    switch (action.type) {
      case "SEARCH_BY_INPUT_VALUE":
        return {    
          ...state,
          inputValue: action.payload,
        };

      default:
        return state;
    }
  };

Ответы (0 шт):