我想知道是否有可能在另一个功能组件中呈现(或打开)一个Functional (Stateless)组件,例如onClick事件?让我们假设以下基本组件;
const FunctionalComponent = () => {
<div>
<h1>Don't snub me because I'm primitive </h1>
<a href="#" onClick={handleClick}>
Click to open another fun
我不明白为什么React中的函数组件中的原型会失败,原因如下:
`index.js:1 Warning: Failed prop type: The prop `profiles` is marked as required in `Home`, but its value is `undefined`.`
应用程序工作正常,配置文件已定义,我正在使用React-redux与挂钩,也许这会导致问题,因为我不知道实际上如何做才能让PropTypes工作
我的家,这里出现了:
import React, { useEffect, useState } from "react";
我遵循一个带有Hooks在线课程的Advanced模式,在这个早期的例子中,他们用以下API创建了一个可扩展组件(比如经典的手风琴或可折叠面板):
<Expandable>
<Expandable.Header>This is the header</Expandable.Header>
<Expandable.Body>This is the content</Expandable.Body>
</Expandable>
他们使用上下文将州expanded传递给可扩展的孩子。到目前为止还不错:
impor
我试着学习redux体系结构,但是我在最基本的东西上失败了。
我创建了类HomePage,并使用()将其连接到存储的状态和调度。
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {HomeButtonClickAction} from "./HomeActionReducer";
import {connect} from "react-redux";
class HomePage extends Com
因此,我有一个Operations.js组件,当父组件(ParamsForm.js)中的特定按钮被切换时,它会被呈现。现在,我想要的是,当父组件中的表单被提交时,我希望父组件表单字段的数据以及子组件表单字段的数据能够登录到控制台上。有什么办法可以做到这一点吗?
ParamsForm.js
import React, { useState, useEffect } from 'react'
import { Form } from 'react-bootstrap'
import styles from '../style.module.css'