score:1
Accepted answer
You can do this fairly easily by using bind
. From MDN:
The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
In your map function, you have access to student
, so you can bind it to your onClick
function like this:
{students.map(
student => <Table.Row onClick={handleRowClick.bind(this, student)}/>
)}
Then you can access student
as the first parameter of your function:
handleRowClick = (student) => console.log(student)
Any other parameters will be filled in after student
if you need them.
Source: stackoverflow.com
Related Query
- How can I get the data out of a table using Semantic UI React
- How can I cache data that I already requested and access it from the store using React and Redux Toolkit
- How can i get the location of the user - Using at React Map GL
- How to retrieve data from the server using fetch get method and show it in a table
- I can not get the state from react router Link component using useLocation. So how can I pass it?
- How can I get data from query string using route in react js
- How to get data from table row click using Semantic's React Table Component
- How can I get the right data from database with react
- How can I mock out all the icons in React `@material-ui/icons` using Jest?
- How to get the data from Redux store using class components in React
- How can I get rid of the `Node "13.0.0-nightly20190802452b393c1f"` so that I can be able to create a react app using the `create-react-app` tool?
- Cannot get a data on the table using react js
- How can I get the jsessionid from a response using react js?
- how to export the return table data to a csv file using react js
- How do you get rid of the console warning “Undefined” when using the React Data Grid
- How can I get the correct current path in React using react router 4.2.2's withRouter?
- How to get data from the backend that needs authorization using React
- How can i get the value using functions in react hooks?
- How can i get the specific array using Lodash in react js
- How can I show the latest data by date using sort in react typescript
- How to get the row data from a table using React?
- How can I prevent to add data if the object property value is different using react js
- How can I iterate through a dictionary in React to get the values separately and display using html?
- How can I get the 1st image from each album with an even ID in React using Fetch?
- In React how can I get access to the props before rendering (without using componentWillReceiveProps)
- How can i make the entire row of a table clickable in react js using <Link> or any other way?
- How can i get a single data from local api using react and redux?
- How can i get errors out of Apollo client in a React front end using GQL
- In my rest webservice request for react using axios, the response json contains html div element. how can I get the value of this element?
- How can I change the scroll direction in React js using javascript and get the scroll variables
More Query from same tag
- How can I insert un-exist record and skip exist record in Supabase?
- Im trying to generate bar chart.js
- React protected route not redirecting to children when authorisation finished
- React lazy does not cause splitting bundle in chunks
- Call this.props.message() onClick
- How to stop browser back button using react js hooks and history api?
- How to load more data on click from Firestore
- How can i eliminate the use of multiple if else conditions in my javascript code
- State is empty in the first render, causing an error. How to solve this?
- ForwardRef warning React-hook-forms with Material UI TextField
- Smooth wrapper background-image transition, when using React onMouseEnter and onMouseLeave events on a childs
- Reactjs useSelector Too many re-renders. React limits the number of renders to prevent an infinite loop
- How to code coverage a promise inside functions while unit testing using Jest
- create downloable file for mobile and desktop
- How to convert JSON to Html in a React App
- I can't upload image to backend with fetch in REACT
- Enzyme async await mock function not being called
- CSS, imposing lines and shapes onto a button?
- Redux saga: I need to pass argument to axios
- How to set the size attribute of a Material UI Select component with multiple options?
- Remove image in map that can't be fetch
- How to update state with redux
- What does `[]` mean in `setState`?
- Use code-prettify with rendered content reactjs
- TypeError: Cannot read property 'post' of null"
- Find in string and from a list matching strings and replace with html tags
- How to use filter from an array while fetching graphql query and also must keep the array order?
- Dockerizing React App but ERR_EMPTY_RESPONSE
- React: trigger class method based on redux state change
- React-final-form Trigger validation on some form fields