score:1
ideally you should wrap mui icon components with <iconbutton> </iconbutton>
you can import that using import {iconbutton} from '@material-ui/core'
so in your case it will be <iconbutton onclick={deletepost}><deleteoutlineoutlinedicon /></iconbutton>
edit: to get the correct value for the name
property try:
let name = e.target.getattribute('name');
and by the way some attribute names aren't really appropriate to use in this condition and in some situations can maybe result in undesired behaviour (for example trying to set a name attribute on a <th>
html element) you want a piece of data (a variable) which normally shouldn't even be done this way as you could just easily do deletepost(e,props.id)
giving props.id
as a parameter directly to your function.
score:0
a bit more context may be needed for people to fully comprehend the issue. on first look i am wondering why you are wrapping a component in a button.
to create an outlined button with an icon using material-ui i'd stick to the material-ui documentation. so something along the lines of:
<button
variant="outlined"
color="secondary"
classname={classes.button}
starticon={<deleteicon />}
>
where <deleteicon/>
is an icon you need to import from the material-ui library.
Source: stackoverflow.com
Related Query
- Material- UI icon disturbing the working of button
- Material UI icon for Link Button not working
- How to put an icon on in the corner of a Material UI button
- reactJS material UI Icon button to upload file
- Prev and Next button is not working correctly at the breakpoints
- display text instead of icon on mouseover - React material ui button
- How to add floating action button on the right-bottom side of the screen using material ui in react
- How to change the style of sorting icon in Material UI table?
- Why do Material UI tabs stop working when I use a .map to populate the content dynamically instead of hard coding?
- ReactJs How to change an icon of a button on the click event?
- Material UI Stepper using custom icon deletes the step number. how to add the number or random text back with a custom icon?
- Material UI Chip cross button / delete button not working
- How to test for a `click` event on the icon button of the `material-ui` AppBar?
- React - what should be the propType of Material UI icon
- Change scroll button Icon on Material UI Tabs component
- Changing the className of a button based on state isn't working properly
- How can I close a Material UI Modal using an X icon rather than just by clicking outside the modal?
- Positioning a Material UI button to the rightmost of row
- ReactJS & Material UI - ClickawayListener is not working properly in the Shadow DOM
- How to check the Radio Button in Cypress. The regular check() is not working
- Link Button to route to the another component is not working in React js
- How to get the TextField value with onclick button event React Material UI
- Material UI ExpandMoreOutlined icon not able to give the exact padding
- Material ui / typography and button on the same line
- How to select the rows of a material table programmatically on onclick event of button -React js
- ReactJS: Material UI floating button onTouchTap calls url the ListItem beneath it
- Material UI - Align icon to center with the Typography text
- Click on radio button and display the corresponding value inside the radio button as selected in react js material UI design
- How to align a Material UI Button and TextField on the same line, at same height?
- Material ui radio button selects the previous button value in reactjs
More Query from same tag
- Function to expand div by time
- How to setState a class object in React?
- How to write a simple functional component that return a array list using map method
- react redux pass this.props to actions from component
- Modal keeps triggering when I press a key
- How to Test Apollo mutation with one variable set to random?
- React multiples useState in one Context
- Push state data to an array each time the button is clicked
- Converting Functional Component code to Class Component code
- this.setState not working on componentWillMount()?
- React-hook-form 'ignores' selects
- Passing construction parameters to redux middleware
- Why is my page not updating with the addition of an element to my array when using React
- TypeScript failing to generate objects in the context of Jest
- React functional component: enable/disable button based on a state value
- webpack-dev-middleware pass through for all routes
- React v16: Uncaught TypeError: Cannot read property 'object' of undefined
- Trying to render a link within a string, within JSX
- Input not changing state REACTJS
- How to prevent User from creating duplicate values using React-Select Creatable?
- I Get the data inside this.props.children;
- Change background of navigation bar, only for home page
- React 16.7 protected routes
- Why my value of array is changing when I'm setting state of other object in react?
- how to show initial values for FieldArray
- React-Query refetchOnMount: false with invalidated query
- Synchronizing state in custom hooks
- How to set timeInterval/timeOut for alert in reactJS?
- How to make a React component look more readable and clean from my example?
- Is it possible to use Flow and arrow functions with React?