score:0
As per my understanding, you've two components: ItemSection and ListItems and you want to call a function in ListItems, that is defined in ItemSection? Is it the correct understanding?
If yes, then you can define your function in ItemSection
and send that function as prop in ItemSection
In ItemSection
:
<ListItems sampleFunction = {(e)=>sampleFunction(e)}/>
In ListItems
:
interface Props{
sampleFunction: Function;
}
and:
<button OnClick = {props.sampleFunction}>{props.title}</button>
This is just a pseudo code.
Source: stackoverflow.com
Related Query
- How to call a function in one React component by button click in another component
- How do I call a function on button click to listen for another mouse click in React Hooks?
- In React, how do I call a function in one component (which is being rendered with React Router) from another component?
- How to make a button onClick in one component call a function in a different component React
- How does one React component call a method in another React component?
- How to make a react component call a function from another Material UI Typescript
- how to move one component to another component on button click in react?
- How to navigate from one component to another by clicking a button using React router
- Trigger a function in another component on click a button from a different component in React
- How to call a function from another file in a React component
- How to call a function with arguments onclick of a button in a react component
- How to destroy and reinitialize component in react on Button click in another component
- How to call action in button click of component, Even though i'm using connect function which is not calling in React Redux
- How to call a function in another component from a different component in react js?
- How to call function of another component in react
- How to show a component When I click a button using function components in react
- how to import a function from one component react to another component to render it?
- Set Recat LInk to Button when button click call the function & after Navigite to Another Component
- How to call another component when I click a button in react?
- How to call multiple function on one click in react
- React : how to get input value from one component to make the ajax call in another component?
- how to pass just the function from one component to other component without passing the whole component or button click
- How to call a function from an imported component in another file in React + Typescript?
- How to render one Component on button click in another Component
- Call function from another React component
- How to replace a component with another one upon event (button click) in react js
- Append a React component in another on button click
- React - How do you call a function from inside another function
- how to send value one component to another component in react js?
- How to call another component from onClick function in ReactJS
More Query from same tag
- Why does AccordionSummary background change to grey when clicking inside TextField in Material-UI?
- Sending state for an Axios POST and data not showing in req.body
- ReactJS, SocketIO & Redux - What is the right design
- How to change sibling component on event from another component in React JS
- React: append to a state array object's array
- onSubmit handler function not working as expected, shows error for split second and disappears, in React.js
- MUI: Avoid line break between Typography components
- Error(Cannot post on rendering a page) in Reactjs and node JS
- Using a functional component within a class
- React Bootstrap: Vertical alignment of row's columns?
- Image Upload using Firebase not uploading images
- Create a rotated text banner (trapezoid) on top of image in React Native
- Get and Map react Js
- How can I get documents from Firestore for current user?
- React: ref becomes null if I call setState in useEffect
- How to Access package.json data inside the application?
- Get object value by dynamic key in typescript
- Getting Error "React.createElement: type is invalid -- expected a string" when using React Router and external component that imports other Components
- Merge object with React state
- Creating a storage reference to upload a image to Google Firebase
- Formik reset form, not to the initial state but a new one
- HandleCheckBox react checked and unchecked , get a list into a state
- Navigate Between Stack Screens using imported button
- Django/React - Cookies Stored Under Wrong Domain Name
- React searching for a user and rendering it out
- React - Styled Component with multiple classes
- why is typescript returning this compile error even though the code is checking for undefined?
- test handle login function with axios
- React - embed props into iframe url
- CSS module is not working in react 16.13.1