Reactjs 如何在React中将道具从父组件(函数)传递到子组件(类)

Reactjs 如何在React中将道具从父组件(函数)传递到子组件(类),reactjs,react-props,Reactjs,React Props,我试图将一些信息传递给子组件类。当我通过函数传递它时,它正在工作,但是如何在子类中处理它呢 父组件 导出默认函数头(道具){ 常量propToChild='ThisProp' 返回() } 子组件 工作正常 我的错误是,我没有在状态中添加道具 现在 const[currentWindow,setCurrentWindow]=React.useState(); 是 const[currentWindow,setCurrentWindow]=React.useState(); 您发送的这段代码

我试图将一些信息传递给子组件类。当我通过函数传递它时,它正在工作,但是如何在子类中处理它呢

父组件

导出默认函数头(道具){
常量propToChild='ThisProp'
返回()
}
子组件

工作正常

我的错误是,我没有在状态中添加道具

现在

const[currentWindow,setCurrentWindow]=React.useState();

const[currentWindow,setCurrentWindow]=React.useState();

您发送的这段代码似乎很好。您可以添加更多上下文/信息吗?可能重复
import React from 'react';
import { withStyles, makeStyles } from '@material-ui/core/styles';

const useStyles = makeStyles(theme => ({
    root: {
        width: '100%',
    },
}));

class FormLayouts extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            open: false,

        };
    }
  render() {
    console.log(this.props);  //it`s empty((
  }
}

export default withStyles(useStyles)(FormLayouts);
const [currentWindow, setCurrentWindow] = React.useState(<FormLayouts urls={props.urls}/>);
const [currentWindow, setCurrentWindow] = React.useState(<FormLayouts />);