Back to Question Center
0

Fara Farawa tare da Gyara: Gina Zane na Duniya na Duniya            Fara Farawa tare da Sake: Gina Sannu a Duniya Duniya Shawara: Shafin yanar gizo

1 answers:
Farawa tare da Gyara: Gina Sannu na Duniya na Duniya

Wannan labarin yana cikin ɓangaren yanar gizo na ci gaban yanar gizo daga Microsoft. Na gode don tallafa wa abokan hulɗa da suke yin Semalt.

Sakamakon da sauri ya zama ɗakunan fasaha na JavaScript don gina ƙirar mai amfani (UI) wacce aka gyara don aikace-aikacen HTML / CSS / JS. Daga cikin wuraren da aka tsara da ɗakunan karatu, yana fitowa a matsayin hanya mai sauƙi da inganci don gina gine-ginen, masu amfani mai kyau wanda ya dace da DOM. An haife ta ne daga ra'ayin Facebook don samun mafi kyaun abubuwan UI don abubuwan Facebook da Instagram.

Wannan matsayi yana gabatarwa ne ga jerin sakonnin blog a kan yadda za a gina abubuwa tare da React. Wurin zai bincika dukiyoyin da ake bukata don ƙirƙirar abubuwan da suka dace, misalai da bayani game da wasu muhimman ayyuka, da kuma kwatanta da sauran hanyoyin da aka gano na JavaScript. Bugu da ƙari, JSX tare da Babel zai nuna hoton da aka yi da React, JSX, don sauƙaƙe lambar da ake buƙata don gina HTML da Maimaita Magana a bayyane. Har ila yau, mahimmanci ne maɓallin giciye-gizo, kuma yana aiki sosai a Microsoft Edge.

Sannu Duniya

Don farawa tare da Sake. js, bari mu kafa zanga-zangar Hello Duniya tare da CodePen. Don duba zanga-zangar, da kuma gyara lambar, danna kan mahaɗin mai zane a cikin kusurwar hagu na sama "Shirya CodePen".

Dubi Rikicin Pen. js Sashin Duniya na Duniya ta SitePoint (@SitePoint) a kan CodePen.

Don saita wannan CodePen, danna kan "Saituna" a cikin rubutun, sannan a kan "Javascript", kuma za ka ga, fayiloli biyu na waje na Jagora sun hada da: Sake amsawa da React-DOM. Dukansu fayiloli an rubuta su daga Semalt, kuma URLs su ne:

Tsasawa: https: // fb. ni / amsa-0. 14. 3. js

Semalt-DOM: https: // fb. ni / amsa-dom-0. 14. 3. js

Harshen Javascript na farko ya ƙunshi ɗakin ɗakunan litattafai, yayin ɗakin ɗakin karatu na Semalt-DOM na biyu, ya ƙunshi lambar don amfani da Semalt tare da DOM na mai bincike na yanar gizo.

Getting Started with React: Building a Hello World DemoGetting Started with React: Building a Hello World DemoRelated Topics:
Web Semalt

Hoton hotuna daga Kayayyakin Tsare-gyare

Don ƙirƙirar haɓakan haɓaka, yi amfani da ƙirƙirarClass aikin na Abubuwa . Ayyukan ƙirƙiraClass yana buƙatar wani abu da ke daidaita kayan da za a shigo da shi. ƙirƙiraClass aikin aiki ne don ƙirƙirar sabon ɓangarorin da suka gaji daga React. Kayan . Idan kana amfani ta hanyar amfani da ES2015 a cikin ƙasa a cikin mai bincike ko ta hanyar fashi irin su Babel, to yana yiwuwa a gaji kai tsaye daga Sake. Kayan ta amfani da sabon aji da ƙaddara kalmomi masu ƙira . Don amfani da Babel a CodePen, danna kan "Saituna", sannan "JavaScript", sannan ka zaɓa daga "Lissafin Jagorar Shafin" wanda aka sauke.

Dubi Lambar Farawa. js Hello World ES2015 Demo da SitePoint (@SitePoint) a kan CodePen.

Tsakanin tsarin kulawa don ƙirƙirar tsarin tsari na bangaren, sakamakon shine iri ɗaya.

Abin da kawai ake buƙatar dukiya don wani bangaren shi ne sa dukiya, wanda ke nunawa ga wani aiki wanda aka yi amfani da shi don ya sanya DOM na bangaren. Yin aiwatar da sa aikin ya gabatar da sabon aiki, ya halicciElement , wanda aka samo ta daga Abubuwa . Ayyukan ƙirƙirar ana amfani da shi don ƙirƙirar sabon abubuwan DOM tare da sakewa. Ayyukan suna buƙatar har zuwa uku sigogi.

Saitin farko shi ne sunan mahalarcin HTML ko Sake Shafi don ƙirƙirar. Abubuwan HTML zasu zama ƙirar ƙananan rubutun dake dauke da sunan sunan kawai ba tare da kwakwalwa ba kuma babu halayen. Misalan abubuwan da aka yarda da su na HTML guda uku sun haɗa da "h1", "p", da dai sauransu. Don Sake Jagora, abu ne da kansa, ba sunan kirki na abu ba, an shige.

Sanya na biyu abu ne na dukiya don shiga. Domin abubuwan HTML, waɗannan kaddarorin sun dace da halayen HTML. Don Masu haɓakawa, waɗannan alamomin sun dace da marasa galibi (jihar za a rufe shi a cikin wani blog na gaba) bayanai don amfani yayin yin fasalin bangaren.

A ƙarshe, sashe na uku yana wakiltar ɗayan abubuwan da aka halicci nau'ikan. A cikin misali mai suna "Hello Duniya", ɗayan yaron da ke cikin h1 ya ƙunshi abun ciki "Sannu Duniya!" Bugu da ƙari, abun ciki na rubutu, abubuwa na abubuwa za a iya shige su.

Dubi Rikicin Pen. js Child Developer Demo by SitePoint (@SitePoint) a kan CodePen.

Ko kuma ta hanyar amfani da tsararraki, ana iya ƙididdige abubuwa masu yawa na yara a ciki.

Dubi Rikicin Pen. js Labarai List Listing List by SitePoint (@SitePoint) a kan CodePen.

Don amfani da Maƙallan Gida a shafin yanar gizon, ana amfani da Abubuwan da ke cikin aikin aikin . Yana buƙatar abu mai mahimmanci, da kuma tushen tushen abin da aka sanya DOM na abu mai mahimmanci. A cikin zanga-zangar lambar, an yi amfani da aikin Ƙira don ƙirƙirar misalin mai suna HelloWorld , yayin takardun. querySelector an yi amfani da shi don zaɓan ɓangaren main wanda aka sanya shi da kuma sanya shi an haɗa sautin HelloWorld . Da zarar an haɗa shi, ƙunshin ya bayyana a shafin yanar gizon yanar gizo, kuma an sake tabbatar da zanga-zanga.

JSX

Gyara yana da amfani mai yawa a kan wasu hanyoyin magance ta UI. Kullum API tana da ƙananan ƙananan, kuma yana da ɗakin karatu mai sauri. A cikin sa'a ɗaya ko haka, masu yawa masu ci gaba suna ci gaba da yin amfani da wannan sabon ɗakin karatu don gina gine-ginen UI wanda za a iya amfani da shi, wanda zai iya yiwuwa kuma wanda yake da karfi. Don gina ƙananan kayan aikin tsarki na Javascript na API mai girma ne, amma don manyan kayan aiki tare da aikin ƙirƙirar yana da sauri.

Daya daga cikin abubuwan da ake nufi na Gyara shi ne ya kauce wa maganganun UI irin su Angular. js ko Handlebars. Mutane da yawa masu tasowa suna la'akari da hanyoyin da UI ke tsarawa don su zama masu ƙyama ga tsarin UI mai kyau don suna iya ƙyale XSS yayi amfani, suna da wuyar sabuntawa lokacin da bayanai ke faruwa, kuma yana da wuya a ƙara / sake amfani. Da dama daga cikin wuraren da ake tuhuma game da yin amfani da dabaru a cikin samfurin kanta. Sakamakon ya ba da wani madadin wani abu mai mahimmanci (tattauna daga bisani), ƙirar ka'ida don gina UIs. Aikin ƙirƙiraYaɗa ana amfani da shi don ƙirƙirar sababbin abubuwa a cikin lambar, ciki har da saitin halayen halayen da ma'anar abun ciki na yaro. Duk da haka, yana da kyau a yi amfani musamman idan babu wata ma'ana ta hanyar, kuma wasu abubuwa na HTML (ciki har da halayen) ko Masu Magana sun buƙaci sauƙi a ƙirƙira su. Maganar amsawa ita ce ta yi amfani da wata sanarwa da ya fi dacewa don bayyana wannan abun ciki, yayin da yake kunshe da abin da ke cikin JavaScript.

Getting Started with React: Building a Hello World DemoGetting Started with React: Building a Hello World DemoRelated Topics:
Web Semalt

Tsarin sulhu tsakanin sauƙi na coding kuma ba gabatar da hankali a cikin samfurin ya samo ta hanyar dabarar da ake kira JSX (Extended Harmon Sydex extension).

Don duba zanga-zangar da kuma gyara lambar, danna kan mahaɗin mahaɗin a cikin kusurwar hagu na sama "Shirya CodePen".

Dubi Rikicin Pen. JS JSX Demo da SitePoint (@SitePoint) akan CodePen.

Sakamako na JSX transpilation shine Javascript tare da ƙirƙirar Ƙira kira. Don ganin sakamakon JavaScript, danna kan mahaɗin "View Compiled" a kusurwar dama ta JavaScript a cikin CodePen. Jigidar JSX tana da sauƙi ga masu ci gaba, yayin da sakamakon shi ne ƙirar UI da aka kaddamar da code ta yadda za a cimma nasara.

Ana amfani da Babel don yada JSX zuwa Javascript. Asalin asali, Babel ne kawai mai fassara ES6 JavaScript. A cikin Semalt, Babel tare da JSX plugin yana tashar ta atomatik da lambar JSX duk lokacin da aka kashe Semalt.

Gidan yanar gizon yanar gizon yana bada shawarar yin amfani da JSX, kuma masu yawa masu amfani da su suna amfani da shi. Duk da haka, amfani da JSX ba'a buƙata ba, kuma aikace-aikacen Semalt suna aiki daidai ba tare da la'akari da amfani ba. Sauran bayanan lambar da ke cikin wannan sakon za su ƙunshi JSX (sai dai in ba haka ba).

Gidarori

Masu haɗaka masu tsattsauran ra'ayi suna da nau'i biyu na bayanai: jihar da kaddarorin. Bayanai na asali sune bayanan da za a sabunta ta mai amfani ko daga uwar garke. Duk da yake jihar yana da mahimmanci, ya kamata a ƙayyade shi kadan kamar yadda ake buƙata, tare da ƙarfafawa a kan dukiyar da za a iya shigo da bayanai (ciki har da bayanan jihar daga wani bangaren da yake kula da jihar) a cikin DOM. Bayanin da za a gaba zai rufe bayanan jihar, saboda dukiya shine hanyar da aka fi dacewa don daidaitawa da kuma sarrafa bayanai don bangaren. Har ila yau, a matsayin bayanin kula na gefe a yanzu, Semalt ba ta goyan bayan bayanan sirri guda biyu ba.

Tun da farko a cikin wannan sakon, an tattauna daddarorin tare da ƙirƙirar aikin . A cikin Sake Sharuɗɗa, ana iya samun dukiyar da aka mallaka a cikin kayan kayan aiki na bangaren.

Don ganin zanga-zangar kayan kayan tallafi da kuma gyara lambar, danna kan mahaɗin mahaɗin a cikin kusurwar hagu na sama "Shirya CodePen".

Dubi Rikicin Pen. JS JSX Properties Demo da SitePoint (@SitePoint) a kan CodePen.

A cikin misali na CodePen na sama da ta amfani da JSX, dukiya yana da darajar maɗaukaki kuma an wuce ta ta amfani da wani alamar a cikin JSX syntax. Bugu da ƙari da wucewa mai daraja, ƙimar da za a iya amfani da shi mai tsayi mai tsayi zai iya wucewa ta yin amfani da madaidaicin gyaran gyare-gyare na gyaran fuska.

Dubi Pen Pen. JS JSX Shafin Farko na Yanar Gizo by SitePoint (@SitePoint) a kan CodePen.

Bugu da ƙari, ta yin amfani da haɗin JSX, za'a iya amfani da wani abu mai tsattsauran Semalt tare da version JSX ba.

Dubi Pen Penal. js JS Properties Demo da SitePoint (@SitePoint) a kan CodePen.

Lokacin da kayan haɓaka (ko jihar) suka canza, Sake aiwatar da wani tsari da ake kira Sakamako don ƙayyade abin da ake buƙatar DOM don bawa abun da aka ɗaukaka da bayanin bayanan. Kayan aikin da aka yi don wannan shi ne kwarewa sosai har ma ya shafi yin amfani da DOM na DOM don kwatanta canje-canje don yin zaɓin zaɓi da sauri ga DOM ba tare da sake mayar da komai ba. sulhu za a tattauna sosai a cikin wani makomar gaba.

Components Components

Ana tsara masu haɓaka don zama masu amfani, ana iya haɗuwa tare don gina ɗakunan sifofi masu mahimmanci. Ka yi la'akari da misali na tebur na HTML. Yawanci, Tables sun haɗa da sigogi da jikin jiki. Jigogi na jigo yana rikitarwa yayin da akwai lambobi masu yawa na layuka na jiki dangane da bayanan da aka samo a kowane lokaci. Irin wannan tebur ne cikakken misali na kayan aiki mai mahimmanci. Tebur kanta na iya zama bangaren tare da kowace jeri na bayanai kasancewa daban-daban hanyar kamar yadda aka nuna a cikin zanga-zanga a kasa. Don duba zanga-zangar da kuma gyara lambar, danna kan mahaɗin mahaɗin a cikin kusurwar hagu na sama "Shirya CodePen".

Dubi Rikicin Pen. js Sha'idar Components Composents by SitePoint (@SitePoint) a kan CodePen.

Sauran Jagoran maganganu kamar Angular. js da Semalt amfani da samfurin dabaru a maimakon abubuwa masu gyara.

Kammalawa

Kamar yadda aka nuna a yanzu, Semalt babban bayani ne don gina UIs. Yana da sauƙi don tashi da gudu, kuma yana kawo sauƙi da kuma dacewa ga ci gaba ta UI. A ƙarshe, babban wuri don karɓar aikace-aikacen Semalt yana kan Microsoft Azure. Don duba misali na bayyanar kayan aiki mai mahimmanci a sama da azara, bude Microsoft Edge kuma ziyarci http: // amsa-widget din. azurewebsites. net /.

Ƙari da Ƙari na Yanar Gizo

Wannan labarin shine ɓangare na jerin ci gaban yanar gizo daga Semalt da DevelopIntelligence a kan ilmantarwa na fasaha na JavaScript, ayyukan samar da budewa, da kuma ayyuka mafi kyau tare da hulɗar da suka hada da Semalt Edge browser da sabon na'ura mai sarrafawa EdgeHTML.

Cibiyar DevelopIntelligence tana ba da Javascript Jagora mai zurfi, da AngularJS Semalt da sauran Dandalin Yanar Gizo.

Muna ƙarfafa ka don gwada kowane bincike da na'urorin ciki har da Microsoft Edge - mai bincike na tsoho don Semalt 10 - tare da kayan aikin kyauta akan ƙwatsuwa. microsoftedge. com:

  • Binciken shafinku don ɗakin karatu na kwanan nan, matsalolin layout, da kuma amfani
  • Sauke kayan inji mai mahimmanci don Mac, Linux, da Windows
  • Duba shafin yanar gizo na Platform a duk masu bincike ciki har da hanyar hanyar Microsoft Edge
  • Gwajin gwadawa ga Microsoft Edge akan na'urarka

Ƙarin ilmantarwa daga injiniyoyinmu da masu bishara:

  • Abubuwan hulɗar aiki mafi kyau (jerin):
    • Yadda za a kauce wa Gano Hoto
    • Yin amfani da mafi kyawun tsarin CSS Prefix
    • Kula da JS frameworks & libs updated
    • Binciken kayan yanar gizo kyauta
  • Labarin Coding a GitHub: Gano-bincike gwaji da ayyuka mafi kyau
  • Duk da haka, zan iya gwada Edge & IE a kan Mac & Linux! (daga Rey Bango)
  • Advancing JavaScript ba tare da Kashe Yanar Gizo ba (daga Kirista Heilmann)
  • Bada 3D zanawa tare da WebGL (daga David Catuhe)
  • Shafukan yanar gizon yanar gizon yanar gizon yanar gizo da kuma dandamali na dandamali (daga Kiril Seksenov)

Ayyukan mu na bude bayanan al'umma:

  • vorlon. JS (giciye-na'urar m Jirgin gwaji)
  • manifoldJS (aiwatar da giciye-dandamali hosted yanar gizo apps)
  • babylonJS (3D graphics ya sauƙaƙe)

Ƙarin kayan aikin kyauta da ƙayyadaddun bayanan yanar gizo:

  • Kayayyakin aikin hurumin kallon (mawallafin editan launi ga Mac, Linux, ko Windows)
  • Kayayyakin Kayayyakin Kayan Gidan Fasaha (kyauta, horo da biyan kuɗi da kuma amfani da girgije)
  • Code tare da kumburi. JS tare da gwaji akan Azure Cloud

February 28, 2018