Skip to content

Conversation

@loreliawand
Copy link

No description provided.

import React from 'react';
import './textAreaField.module.css';

const TextAreaField = (props) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const TextAreaField = (( field, name, onChange }) => {
или строкой ниже
const { field, name, onChange } = props
потом вставляешь куда надо уже без слова пропс

import React from 'react';

const FormHeader = () => {
return <h1 style={{ textAlign: 'center' }}>Создание анкеты</h1>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Дробление круто, но иногда излишне)

import '../cssModules/button.module.css';
import './button.module.css';

class Button extends Component {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3-е же вроде на функциональных компонентах

@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import '../cssModules/button.module.css';
import './button.module.css';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут и еще много где, ошибка с импортом, когда работаешь с модулями , принцип отличается от обычного css.
Из модуля ты импортируешь объект, допустим styles
и строка выглядит так import styles from './button.module.css';
потом тебе надо применить стиль, допустим в твоей кнопке :
button className = {styles.CustomButtonContainer}
в css файле, должен быть
. CustomButtonContainer {
....какие-то свойства
}
}

return (
<form onSubmit={this.mySubmit} onReset={this.resetForm}>
return (
<div>
Copy link

@RinalinDS RinalinDS Aug 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вот тут как раз, мне кажется лучше раздробить, вынести хотя бы первое часть условия в отдельную компоненту, например <FinishedForm -> или как фантазия работает, в идеале , в разметке App можно оставить вообще одну строку : {submit ? <FinishedForm ....props/> : <Form ......props />

src/App.js Outdated

render() {
const submit = this.state.submit;
if (submit === false) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

хоть и удалено, но лучше не пиши никогда условия типо if x === true , заменяй просто на if (x)
если отрицание , то не if (x === false) , a if (!x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants