-
Notifications
You must be signed in to change notification settings - Fork 6
Homework 3 #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Homework 3 #34
Conversation
| import React from 'react'; | ||
| import './textAreaField.module.css'; | ||
|
|
||
| const TextAreaField = (props) => { |
There was a problem hiding this comment.
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>; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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'; | |||
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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)
No description provided.