I want to read the onClick event value properties. But when I click on it, I see something like this on the console:
SyntheticMouseEvent {dispatchConfig: Ob
I found the solution of passing param as a tag's attribute quite reasonable.
However it has limitations:
That's why I came up with this library: react-event-param
It:
Usage example:
import { setEventParam, getEventParam } from "react-event-param";
class List extends Component {
onItemClick = e => {
const index = getEventParam(e.target);
// Do something with index
};
render() {
return (
{this.props.items.map((itemText, index) => (
-
{{ itemText }}
))}
);
}
}
export default List;