Skip to content

Homework 3#34

Open
loreliawand wants to merge 3 commits intoxzfantom:mainfrom
loreliawand:homework_3
Open

Homework 3#34
loreliawand wants to merge 3 commits intoxzfantom:mainfrom
loreliawand:homework_3

Conversation

@loreliawand
Copy link
Copy Markdown

No description provided.

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

const TextAreaField = (props) => {
Copy link
Copy Markdown

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>;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment thread src/Button/Button.jsx
import '../cssModules/button.module.css';
import './button.module.css';

class Button extends Component {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment thread src/Button/Button.jsx
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import '../cssModules/button.module.css';
import './button.module.css';
Copy link
Copy Markdown

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 {
....какие-то свойства
}
}

Comment thread src/App.js
return (
<form onSubmit={this.mySubmit} onReset={this.resetForm}>
return (
<div>
Copy link
Copy Markdown

@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 />

Comment thread src/App.js Outdated

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

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