Modern Full-Stack Development



Download 5,64 Mb.
Pdf ko'rish
bet81/107
Sana06.08.2021
Hajmi5,64 Mb.
#140576
1   ...   77   78   79   80   81   82   83   84   ...   107
Bog'liq
Modern Full-Stack Development Using TypeScript, React, Node

 The Main Code: state.ts
Okay, now we come to the final source file that makes up BattleJong, and it’s where most 
of the real work is: state.ts. As with MailBag, this code is concerned with constructing 
an object that will contain the application state that will be housed in the BaseLayout 
component and then flow down to any child components that need it. The methods 
exposed as part of this object are concerned with mutating state in some way, but in this 
app, that really means it winds up containing a good chunk of the core game logic since 
that logic will ultimately mutate state, so it’s logical for it to be here.
Chapter 11   time for fun: BattleJong, the Client


330
It begins, as most of our modules do, with some imports:
import React from "react";
import { createSocketComm } from "./socketComm";
React is obvious – we won’t get very far building a React app without importing React 
itself! – and socketComm, you of course know, is how we talk to the server.

Download 5,64 Mb.

Do'stlaringiz bilan baham:
1   ...   77   78   79   80   81   82   83   84   ...   107




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish