From c137c644e3f7702b9fc07e4953744d195ced9288 Mon Sep 17 00:00:00 2001 From: Laktionov Anton Date: Tue, 2 Jun 2026 19:42:31 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D0=BE=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B0=20=D1=81=20=D0=B6=D0=B8=D0=B7=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=D0=BC=D0=B8=20=D1=86=D0=B8=D0=BA=D0=BB=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.jsx | 33 +++++++++++++++++++++++++++++++-- src/main.jsx | 2 -- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 6bf3ac6..021d8b6 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,10 +1,39 @@ -// удаляем все, оставляя лишь пустую функцию App ниже +import React from 'react' + +class MyComponent extends React.Component { + constructor(props) { + super(props) + this.state = { count: 0 } + } + + componentDidMount() { + console.log('Компонент смонтирован') + } + + componentDidUpdate(prevProps,prevState) { + console.log('Компонент обнвлен') + if(prevState.count !== this.state.count) { + console.log('Состояние изменилось') + } + } + + componentWillUnmount() { + console.log('Компонент будет размонтирован') + } + + render() { + return
+ Привет мир! {this.props.name} {this.state.count} + +
+ } +} function App() { return ( <> - {/* Добавьте тестовый контент для проверки */}

Hello, React!

+ ) } diff --git a/src/main.jsx b/src/main.jsx index 950e96a..7e925e8 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -4,7 +4,5 @@ import { createRoot } from 'react-dom/client' import App from './App.jsx' createRoot(document.getElementById('root')).render( - - )