-
Notifications
You must be signed in to change notification settings - Fork 2
[week2]reviewed feedback JOMINJI
jominji edited this page Nov 26, 2019
·
1 revision
- 스타일 컴포넌트를 사용하면 className으로 판별해서 스타일을 먹일필요가 없군요.
const tempPictures:File[] = pictures;
tempPictures.push(newpicture);
// 로 변경
const tempPictures = [...pictures, newpicture];
let fruits = ['Apple','Orange','Banana'];
let newFruitArray = [...fruits];
console.log(copiedList); // ['Apple','Orange','Banana']
let arr1 = ['A', 'B', 'C'];
let arr2 = ['X', 'Y', 'Z'];
let result = [...arr1, ...arr2];
console.log(result); // ['A', 'B', 'C', 'X', 'Y', 'Z']
let fruits = ['Apple','Orange','Banana'];
let newFruits = ['Cherry', ...fruits];
console.log(newFruits); // ['Cherry','Apple','Orange','Banana']
let fruits = ['Apple','Orange','Banana'];
var getFruits = (f1, f2, f3) => {
console.log(Fruits: ${f1}, ${f2} and ${f3}); };
getFruits(...fruits); // Fruits: Apple, Orange and Banana
var obj1 = { id: 101, name: 'Jhon Doe' }
var obj2 = { age: 25, country: 'USA'}
const employee = { ...obj1, ...obj2 }
console.log(employee); //{ "id": 101, "name": "Jhon Doe", "age": 25, "country": "USA" }
var alphabets = ["A", ..."BCD", "E"];
console.log(alphabets); // [ 'A', 'B', 'C', 'D', 'E' ]
// before
const tempPictures:File[] = pictures; // copy by reference!!
tempPictures.push(newpicture);
//after
const tempPictures = [...pictures, newpicture]; // copy by value
// before
const dbContent = contents.map((element2) => {
if (element2.type === 'image') {
element2.content = urls.shift(); // 재할당하면 좋지 않다!!
// after
const dbContent = contents.map((element2) => {
if (element2.type === 'image') {
const obj = {
type: element2.type,
content: ''
};
return obj
}...
의 default type은 "submit" 이다. submit은 예상치 못한? 행동을 할 수 있다. page를 reload한다는등 그러므로 type속성은 꼭 지정해주자.
- button
- submit
- reset
which is often not the desired behavior and may lead to unexpected page reloads.
<!-- before -->
<button onClick={addDescription}>글씨 추가</button>
<!-- after -->
<button type="button" onClick={addDescription}>글씨 추가</button>