scripts: {
......
"dev": "concurrently \"npm run start\" \"npm run api\""
}
Показывает анимацию удаления именно последнего элемента
{boxes.map((item, index) => (
<Box key={index} item={item} onDelete={onDelete} />
))}
componentDidMount() { // "При загрузке страницы запускается функция" это здесь
if (something) {
this.setState({ something: 'else' })
}
}
<Droppable droppableId="droppable2" type="LIST">
....
onDragEnd(result) {
....
console.log(result.destination.droppableId, result);
if(result.destination.droppableId === 'droppable2') {
// переместить в this.state.items2, или еще как-нибудь отметить позицию айтема
}
.....
}
type: A TypeId(string) that can be used to simply accept only the specified class of <Draggable />. <Draggable />s always inherit type from the <Droppable /> they are defined in.
For example, if you use the type PERSON then it will only allow <Draggable />s of type PERSON to be dropped on itself.
<Draggable />s of type TASK would not be able to be dropped on a <Droppable /> with type PERSON.
If no type is provided, it will be set to 'DEFAULT'.
React.useEffect(() => {
window.addEventListener('popstate', doStuff)
return () => {
window.removeEventListener('popstate', doStuff)
}
}, [doStuff]) // function doStuff() {}
await Todo.find({}).lean()
constructor() {
..
// this.getRate(); из конструктора убрать
}
componentDidMount() {
this.getRate(); // сюда добавить
}
"scripts": {
....
"server": "nodemon server.js",
"client": "npm start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\""
},
props.menu.map(pizza =>
<CSSTransition
key={pizza._id}
timeout={300} // это задержка?
props.menu.map((pizza, index) =>
<CSSTransition
key={pizza._id}
timeout={300 * index} // тогда можно попробовать так
for(i = 0;i < 20;i++){
let shouldBreak = false
for(j = 0;j < 20;j++){
if(asdadsda == j){
shouldBreak = true
break;
}
}
if(shouldBreak) break
}
... you might find it easier to think that effects happen “after render”. React guarantees the DOM has been updated by the time it runs the effects.