This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src / forms / Anketa.jsx: | |
import React from 'react'; | |
// import './css/Anketa.css'; // раскомментировать для стилизации формы | |
const Anketa = () => { | |
// обработчик отправки формы (заглушка) | |
const handleSubmit = (e) => { | |
e.preventDefault(); | |
console.log('Форма отправлена'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, createContext, useContext } from 'react'; | |
import './css/FormContainer.css'; | |
// создание контекста для формы | |
const FormContext = createContext(null); | |
// контекст тут нужен для упрощения взаимодействия между родительской формой и её дочерними инпутами | |
// вместо передачи данных и функций через props на каждый уровень, createContext и useContext позволяют проще делиться | |
// состоянием (formData) и функцией обновления (handleChange) напрямую | |
// это будет особенно полезно, когда в форме будет много полей |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src / forms / FormContainer.jsx: | |
import {useState} from 'react'; | |
import './css/FormContainer.css'; | |
// дочерняя компонента получает данные и функции от родителя через пропсы | |
// в идеале, естественно, нужно разместить родителя и дочерние компоненты в отдельных файлах! | |
function FormInput({label, type, name, value, onChange}) { | |
const handleInputChange = (e) => { | |
onChange(e.target.value); // вызов коллбэк-функции для обновления состояния родительской формы |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src / forms / AsyncForm.jsx: | |
import { useActionState, useEffect } from 'react'; | |
import './css/AsyncForm.css'; | |
function AsyncForm() { | |
const [state, formAction, isPending] = useActionState( | |
async (_prevState, formData) => { | |
try { | |
const name = formData.get('name'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src / forms / BasicForm.jsx: | |
import { useState } from 'react'; | |
function BasicForm() { | |
const [formData, setFormData] = useState({ name: '' }); | |
const handleSubmit = (e) => { | |
e.preventDefault(); | |
console.log('Отправлено:', formData); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Classes</title> | |
</head> | |
<body> | |
<p> | |
Задание 1 | |
Реализовать класс Button, который содержит ширину, высоту, текст кнопки и метод showBtn(),<br> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Создание класса "Новости"</title> | |
</head> | |
<body> | |
<div id="total"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE Store | |
SELECT Category.name, COUNT(Product.id) AS product_count | |
FROM Product | |
INNER JOIN Category | |
ON Product.id_category = Category.id | |
INNER JOIN Delivery | |
ON Product.id = Delivery.id_product |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE Store | |
SELECT Product.name AS Product_name, Producer.name AS Producer_name | |
FROM Producer | |
LEFT JOIN Product | |
ON Producer.id = Product.id_producer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <iostream> | |
#include <windows.h> | |
#include <conio.h> | |
using namespace std; | |
enum GameObject : short { HALL, WALL, COIN, ENEMY }; | |
enum Color : short { | |
BLACK, DARKBLUE, DARKGREEN, TURQUOISE, DARKRED, | |
PURPLE, DARKYELLOW, GREY, DARKGREY, BLUE, GREEN, |
NewerOlder