小编Rag*_*hav的帖子

如何在 ReactJs Material UI Grid 中具有不同的水平和垂直间距

在 Material UI Grid 中,为了垂直间隔 Grid Item,我在 Grid Container 中提供了间距。它在大屏幕上看起来不错,但在移动设备上,它会导致网格项目之间的水平间距尴尬。

<Grid container spacing={24}>
  <Grid item xl={6} md={6} sm={12} xs={12}>
    <TextField
      required
      id="outlined-email-input"
      label="Customer Name"
      name="email"
      fullWidth
    />
  </Grid>
  <Grid item xl={6} md={6} sm={12} xs={12}>
    <TextField
      required
      id="outlined-email-input"
      label="Customer Name"
      name="email"
      fullWidth
    />
  </Grid>
</Grid>
Run Code Online (Sandbox Code Playgroud)

如何在网格中具有不同的垂直和水平间距?

css grid reactjs material-ui

17
推荐指数
2
解决办法
2万
查看次数

React Arrow Function Component - setState is not defined

I am trying to setState in an arrow function component but getting an error "setState is not defined".

I tried setting state in handleChange using setState({ selectedSlot }) and this.setState({ selectedSlot }) but nothing worked.

 const AddAssetActivity = props => {
 let { variations, slots, priceStructure } = props;

 let state = {
   selectedSlot: { "0": "00", "1": "11" },
   cal: 1
 };

 let handleChange = (event, value) => {
   let selectedSlot = state.selectedSlot;
   selectedSlot[value.variation] = value.slot;
   setState({ selectedSlot }); …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs arrow-functions

5
推荐指数
1
解决办法
285
查看次数

标签 统计

reactjs ×2

arrow-functions ×1

css ×1

grid ×1

javascript ×1

material-ui ×1