Homework 3#34
Conversation
| import React from 'react'; | ||
| import './textAreaField.module.css'; | ||
|
|
||
| const TextAreaField = (props) => { |
There was a problem hiding this comment.
const TextAreaField = (( field, name, onChange }) => {
или строкой ниже
const { field, name, onChange } = props
потом вставляешь куда надо уже без слова пропс
| import React from 'react'; | ||
|
|
||
| const FormHeader = () => { | ||
| return <h1 style={{ textAlign: 'center' }}>Создание анкеты</h1>; |
| import '../cssModules/button.module.css'; | ||
| import './button.module.css'; | ||
|
|
||
| class Button extends Component { |
There was a problem hiding this comment.
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.
тут и еще много где, ошибка с импортом, когда работаешь с модулями , принцип отличается от обычного 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.
вот тут как раз, мне кажется лучше раздробить, вынести хотя бы первое часть условия в отдельную компоненту, например <FinishedForm -> или как фантазия работает, в идеале , в разметке App можно оставить вообще одну строку : {submit ? <FinishedForm ....props/> : <Form ......props />
|
|
||
| render() { | ||
| const submit = this.state.submit; | ||
| if (submit === false) { |
There was a problem hiding this comment.
хоть и удалено, но лучше не пиши никогда условия типо if x === true , заменяй просто на if (x)
если отрицание , то не if (x === false) , a if (!x)
No description provided.