我正在用react.js开发一个material-ui包。我只想打开一个抽屉,然后在单击屏幕上的任意位置时将其关闭。
我的代码就像这样
import React, {Component} from 'react';
import Drawer from 'material-ui/Drawer';
import MenuItem from 'material-ui/MenuItem';
import AppBar from 'material-ui/AppBar';
import MuiThemeProvider from '
在我的React代码库中,我集成了Redux工具react-redux,并使用useDispatch钩子从我的视图中分派操作。我只是有一个问题,我不能访问更新后的值刚刚更新的商店。是否有一种方法可以让我像await一样等待状态更新的完成,或者类似于一个回调,在那里我可以执行其他代码?
我的代码是这样的:
import React from 'react';
import { useDispatch } from "react-redux";
import { setCore } from "../store/global";
// the va
在学习react时,我制作了菜单,在菜单上单击,我打开了一个表单。我想有一个‘关闭’图标在表单上,当按下关闭表单,并再次在菜单上点击打开它。 我制作了一个处理表单状态的父组件(子组件)。它管理showchild = true或false。 //this is button defined on form compenent
<button onClick={this.props.onClose}>Self Close</button>
//this is parent component
import React from 'react';
im