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, useEffect} from 'react'; | |
| import {QueryClient, QueryClientProvider, useQuery} from '@tanstack/react-query'; | |
| import Dexie from 'dexie'; | |
| import './App.css'; | |
| // ініціалізація Dexie, npm install dexie | |
| // https://dexie.org/ | |
| const db = new Dexie('CartDatabase'); | |
| db.version(1).stores({ | |
| cart: '++id, title, price, image', // схема для таблиці кошика | 
  
    
      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
    
  
  
    
  | создать папку files в папке react на atwebpages.com | |
| ======================================================================================= | |
| App.jsx: | |
| import { useState, useEffect } from 'react'; | |
| import { QueryClient, QueryClientProvider, useQuery } from '@tanstack/react-query'; | |
| import './App.css'; | 
  
    
      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, useEffect, useRef } from 'react'; | |
| import { QueryClient, QueryClientProvider, useQuery } from '@tanstack/react-query'; | |
| import './App.css'; | |
| const API_URL = 'http://sunmeat.atwebpages.com/react/api.php'; | |
| // екземпляр QueryClient | |
| const queryClient = new QueryClient(); | |
| const truncateText = (text, maxLength) => | |
| text.length > maxLength ? text.slice(0, maxLength) + '...' : text; | 
  
    
      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
    
  
  
    
  | https://www.pythonanywhere.com/user/sunmeat/files/home/sunmeat/alex.py?edit: | |
| from flask import Flask, jsonify | |
| from flask_cors import CORS | |
| app = Flask(__name__) | |
| # Enable CORS for all routes, allowing all origins | |
| CORS(app, resources={r"/api/*": {"origins": "*"}}) | 
  
    
      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
    
  
  
    
  | App.jsx: | |
| import React, {Component} from 'react'; | |
| import {QueryClient, QueryClientProvider, useQuery, useMutation, useQueryClient} from '@tanstack/react-query'; // npm install @tanstack/react-query | |
| import Dexie from 'dexie'; // npm install dexie | |
| import './App.css'; | |
| const db = new Dexie('CartDatabase'); | |
| db.version(1).stores({ | |
| cart: 'id, title, price, image, quantity', | 
  
    
      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
    
  
  
    
  | App.jsx: | |
| // імпортуємо хуки та компонент Provider з react-redux | |
| import {useSelector, useDispatch, Provider} from 'react-redux' | |
| // !!! npm install react-redux @reduxjs/toolkit !!! | |
| // хук useSelector дозволяє отримати доступ до стану сховища - єдиного центру даних для всього додатка | |
| // у сховищі (store) зазвичай лежить один великий об'єкт - дерево стану, для всього | |
| // useSelector "селектить" (вибирає) потрібний шматок даних із цього глобального стану | 
  
    
      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
    
  
  
    
  | using ExtendedNumerics; // BigDecimal - ставимо через Nuget | |
| using System.Numerics; // BigInteger - вбудований тип | |
| using System.Text; | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| Console.OutputEncoding = Encoding.UTF8; | 
  
    
      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
    
  
  
    
  | using System.Runtime.InteropServices; // DllImport | |
| using System.Text; // Console.InputEncoding = Encoding.UTF8; | |
| namespace ConsoleIO | |
| { | |
| [StructLayout(LayoutKind.Sequential, Pack = 1)] | |
| public struct ConsoleFont | |
| { | |
| public uint Index; | |
| public short SizeX, SizeY; | 
  
    
      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
    
  
  
    
  | using System.Text; | |
| namespace Conditions | |
| { | |
| class TestClass | |
| { | |
| } | |
| class Program | |
| { | 
  
    
      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
    
  
  
    
  | using System.Reflection; | |
| using System.Text; | |
| namespace Cycles | |
| { | |
| static class Input | |
| { | |
| static int number; | |
| public static int Number() |