Home
%3CLINGO-SUB%20id%3D%22lingo-sub-912093%22%20slang%3D%22en-US%22%3EGetting%20started%20with%20React%20Native%20for%20Windows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-912093%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20you're%20familiar%20with%20web%20development%2C%20you'll%20know%20for%20sure%20React.%20This%20framework%2C%20built%20by%20Facebook%2C%20is%20becoming%20more%20and%20more%20popular%20to%20build%20client-side%20web%20experiences.%20Unlike%20other%20frameworks%20like%20Vue.js%20or%20Angular%2C%20React%20focuses%20only%20on%20the%20View%20component%20of%20a%20web%20application.%20It%20isn't%20a%20fully%20fledged%20framework%20like%20jQuery%20or%20Angular%2C%20which%20have%20an%20opinion%20on%20everything%20and%2C%20as%20such%2C%20they%20provide%20lot%20of%20features%20to%20perform%20all%20the%20kind%20of%20tasks%2C%20from%20HTML%20templates%20to%20APIs%20to%20handle%20HTTP%20requests.%20You%20need%20to%20rely%20on%20plain%20old%20JavaScript%20(or%20TypeScript%2C%20if%20you%20prefer)%20or%20on%203rd%20party%20libraries%20to%20achieve%20these%20goals.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhat%20makes%20React%20peculiar%20(and%20not%20so%20easy%20to%20understand%20at%20the%20beginning%20if%20you're%20coming%20from%20traditional%20client-side%20development%20for%20Windows%2C%20like%20me)%20is%20the%20different%20development%20approach.%20You%20may%20be%20used%20to%20patterns%20like%20MVC%20or%20MVVM%2C%20which%20goal%20is%20to%20separate%20the%20UI%20from%20the%20business%20logic%20so%20that%20you%20can%20make%20your%20application%20easier%20to%20test%2C%20maintain%20and%20evolve.%20React%2C%20instead%2C%20being%20focused%20only%20on%20the%20View%2C%20is%20based%20on%20the%20concept%20of%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ecomponents%3C%2FSTRONG%3E%2C%20which%20are%20the%20different%20pieces%20that%20compose%20a%20page.%20Every%20component%20is%20independent%20from%20the%20other%20and%20it%20includes%20both%20the%20UI%20and%20the%20logic%20to%20handle%20the%20various%20events%20that%20it%20can%20trigger.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESince%20code%20is%20easier%20to%20understand%20than%20words%2C%20here%20is%20how%20a%20typical%20React%20component%20looks%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-javascript%20hljs%22%3E%3CSPAN%20class%3D%22hljs-class%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Eclass%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-title%22%3EApp%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3Eextends%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-title%22%3EReact%3C%2FSPAN%3E.%3CSPAN%20class%3D%22hljs-title%22%3EComponent%3C%2FSPAN%3E%20%3C%2FSPAN%3E%7B%0A%0A%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Econstructor%3C%2FSPAN%3E(props)%20%7B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Esuper%3C%2FSPAN%3E(props)%3B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ethis%3C%2FSPAN%3E.showAlert%20%3D%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ethis%3C%2FSPAN%3E.showAlert.bind(%3CSPAN%20class%3D%22hljs-keyword%22%3Ethis%3C%2FSPAN%3E)%3B%0A%20%20%7D%0A%0A%20%20componentDidMount()%20%7B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-built_in%22%3Ewindow%3C%2FSPAN%3E.alert(%3CSPAN%20class%3D%22hljs-string%22%3E%22The%20component%20is%20ready!%22%3C%2FSPAN%3E)%3B%0A%20%20%7D%0A%20%20%0A%20%20showAlert()%20%7B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-built_in%22%3Ewindow%3C%2FSPAN%3E.alert(%3CSPAN%20class%3D%22hljs-string%22%3E%22Hello%20world!%22%3C%2FSPAN%3E)%3B%0A%20%20%7D%0A%0A%20%20render()%20%7B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ereturn%3C%2FSPAN%3E%20(%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22xml%22%3E%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3Ediv%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EclassName%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22App%22%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3Eheader%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EclassName%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22App-header%22%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3Ebutton%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EonClick%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%7Bthis.showAlert%7D%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3EClick%20me!%3CSPAN%20class%3D%22hljs-tag%22%3Ebutton%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3Eheader%3C%2FSPAN%3E%26gt%3B%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3Ediv%3C%2FSPAN%3E%26gt%3B%0A%20%20%20%20%20%20)%3B%0A%20%20%7D%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EAs%20you%20can%20see%2C%20the%20component%20defines%20both%20the%20UI%20and%20the%20logic%20to%20handle%20the%20events%20associated%20with%20it%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Erender()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efunction%20is%20the%20one%20which%20declares%20the%20UI%20that%20this%20component%20will%20display.%3C%2FLI%3E%0A%3CLI%3EThe%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EshowAlert()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efunction%20is%20triggered%20when%20the%20user%20clicks%20on%20the%20button%20declared%20in%20the%20UI.%3C%2FLI%3E%0A%3CLI%3EThe%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EcomponentDidMount()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efunction%20is%20part%20of%20the%20component's%20lifecycle%20and%20it's%20triggered%20when%20the%20component%20has%20been%20rendered%20and%20it's%20ready%20to%20work.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20UI%20might%20look%20like%20HTML%2C%20but%20it's%20actually%20defined%20using%20a%20special%20language%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EJSX%3C%2FSTRONG%3E%2C%20which%20is%20based%20on%20XML%20and%20it%20allows%20to%20declare%20your%20UI%20with%20JavaScript.%20It%20may%20sound%20blasphemous%2C%20but%20the%20goal%20is%20to%20go%20past%20the%20standard%20templating%20approach%20used%20by%20other%20frameworks%2C%20which%20is%20good%20when%20you%20just%20want%20to%20display%20some%20data%2C%20but%20it%20has%20its%20limitations%20when%20you%20want%20to%20do%20something%20more%20complex%2C%20like%20displaying%20or%20hiding%20something%20based%20on%20a%20specific%20condition.%20In%20the%20previous%20code%20you%20can%20see%20an%20example%20of%20this%20approach.%20In%20jQuery%20or%20another%20similar%20framework%2C%20you%20would%20need%20to%20use%20an%20API%20to%20get%20a%20reference%20to%20the%20button%20and%20then%20hook%20up%20the%20event.%20In%20React%2C%20instead%2C%20we%20can%20declare%20it%20just%20inline%2C%20by%20subscribing%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EonClick%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eevent%20and%20by%20specifying%20the%20name%20of%20the%20function%20to%20invoke%20inside%20curly%20brackets.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCODE%3E%3C%2FCODE%3E%3C%2FP%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E%3CBUTTON%3E%3C%2FBUTTON%3E%3C%2FCODE%3E%3CBUTTON%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Emay%20look%20like%20plain%20HTML%20tags%2C%20but%20they're%20actually%20not.%20You%20can%20notice%20it%2C%20for%20example%2C%20by%20the%20usage%20of%20two%20attributes%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EclassName%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EonClick%3C%2FCODE%3E%2C%20which%20don't%20exist%20in%20standard%20HTML.%20React%20will%20take%20care%20of%20translating%20these%20JSX%20controls%20into%20the%20corresponding%20HTML%20ones%20and%20to%20handle%20the%20various%20state%20changes.%20To%20make%20thing%20simpler%2C%20the%20JSX%20controls%20in%20React%20resembles%20as%20much%20as%20possible%20the%20HTML%20ones%2C%20so%20the%20syntax%20will%20be%20very%20familiar%20to%20you.%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDue%20to%20the%20growing%20popularity%20of%20React%2C%20Facebook%20has%20decided%20to%20extend%20the%20framework%20to%20support%20mobile%20development%20with%20the%20introduction%20of%20React%20Native.%20This%20was%20made%20possible%20by%20the%20fact%20that%20one%20of%20the%20core%20features%20offered%20by%20React%20is%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eabstraction%3C%2FSTRONG%3E.%20React%20itself%20doesn't%20offer%20too%20many%20built-in%20features%20which%20are%20tight%20to%20a%20specific%20platform%2C%20but%20it%20leverages%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Erender%20target%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20make%20sure%20that%20the%20View%20is%20rendered%20in%20the%20proper%20way.%20In%20the%20previous%20examples%2C%20React%20used%20a%20render%20target%20that%20can%20turn%20JSX%20into%20plain%20HTML.%20As%20such%2C%20React%20Native%20in%20nothing%20more%20than%20React%20with%20a%20different%20render%20target%2C%20which%20turns%20JSX%20into%20mobile%20controls.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EReact%20Native%2C%20from%20a%20mobile%20development%20experience%20point%20of%20view%2C%20can%20be%20seen%20as%20a%20mix%20between%20the%20classic%20Xamarin%20approach%20and%20the%20Xamarin%20Forms%20one.%20Like%20Xamarin%20Forms%2C%20it%20shares%20the%20opportunity%20of%20building%20truly%20native%20applications.%20React%20Native%2C%20in%20fact%2C%20doesn't%20use%20a%20WebView%20to%20render%20the%20HTML%20and%20JavaScript%2C%20like%20other%20web%20based%20technologies%20like%20Cordova.%20The%20various%20JSX%20controls%20are%20rendered%20using%20the%20corresponding%20native%20controls%20for%20Android%20or%20iOS%2C%20making%20the%20UI%20and%20the%20user%20experience%20coherent%20with%20the%20rest%20of%20the%20operating%20system.%20Xamarin%20Forms%20does%20the%20same%2C%20but%20by%20leveraging%20XAML%20as%20a%20markup%20language.%20However%2C%20like%20classic%20Xamarin%2C%20the%20goal%20of%20React%20Native%20isn't%20really%20to%20write%20an%20application%20once%20and%20run%20it%20everywhere%2C%20but%20rather%20allowing%20a%20team%20to%20build%20mobile%20applications%20using%20the%20same%20knowledge%20and%20sharing%20the%20same%20libraries.%20You%20will%20find%20out%2C%20in%20fact%2C%20that%20React%20Native%20includes%20many%20controls%20which%20are%20cross-platform%20(like%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EText%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eor%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EImage%3C%2FCODE%3E)%2C%20but%20also%20many%20others%20which%20are%20specific%20for%20Android%20and%20iOS%20and%20that%20can't%20be%20used%20in%20a%20cross-platform%20way.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EReact%20Native%20includes%20a%20render%20target%20for%20iOS%20and%20Android%20but%2C%20since%20BUILD%202018%2C%20Microsoft%20has%20started%20to%20work%20on%20a%20render%20target%20for%20Windows.%20At%20BUILD%202019%2C%20however%2C%20Microsoft%20has%20announced%20a%20rewrite%20of%20the%20framework%20from%20C%23%20to%20C%2B%2B%2C%20with%20the%20goal%20to%20get%20better%20performances%20and%20to%20be%20better%20aligned%20with%20the%20core%20react-native%20implementation%2C%20which%20is%20built%20in%20C%2B%2B%20as%20well.%20The%20technology%20behind%20this%20framework%20is%20the%20Universal%20Windows%20Platform.%20React%20Native%20for%20Windows%20creates%20a%20new%20UWP%20project%20and%20the%20various%20JSX%20controls%20are%20rendered%20using%20native%20controls%20from%20the%20Universal%20Windows%20Platform%20and%2C%20in%20the%20future%2C%20from%20the%20WinUI%20library.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20framework%20is%20really%20flexible%20and%20it%20opens%20up%20many%20opportunities%20for%20Windows%20developers%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EYou%20can%20build%20UWP%20applications%20from%20scratch%20using%20only%20React%20Native.%3C%2FLI%3E%0A%3CLI%3EYou%20can%20integrate%20React%20Native%20components%20inside%20native%20UWP%20applications%2C%20allowing%20you%20to%20mix%20UWP%20controls%20with%20React%20Native%20controls.%3C%2FLI%3E%0A%3CLI%3EYou%20can%20integrate%20React%20Native%20components%20inside%20WPF%20or%20Windows%20Forms%20applications%2C%20by%20leveraging%20XAML%20Islands%2C%20the%20technology%20which%20allows%20to%20render%20UWP%20controls%20inside%20Win32%20applications.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EIn%20this%20blog%20post%20we're%20going%20to%20explore%20all%20these%20options.%20However%2C%20the%20purpose%20of%20this%20post%20isn't%20to%20be%20a%20comprehensive%20overview%20of%20React%20Native.%20I%20will%20give%20for%20granted%20that%20you're%20already%20familiar%20with%20this%20technology.%20If%20it's%20not%20your%20case%20and%20you%20want%20to%20learn%20more%2C%20you%20will%20find%20lot%20of%20tutorials%20and%20documentation%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ffacebook.github.io%2Freact-native%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethe%20official%20website%3C%2FA%3E.%20You%20can%20also%20start%20from%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Freactjs.org%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethe%20React%20website%3C%2FA%3E.%20The%20main%20concepts%2C%20in%20fact%2C%20are%20exactly%20the%20same%20between%20the%20two%20platforms%2C%20with%20the%20only%20difference%20that%20React%20outputs%20HTML%2C%20while%20React%20Native%20native%20controls.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22getting-started-with-react-native-for-windows-1%22%20id%3D%22toc-hId-1649455928%22%20id%3D%22toc-hId-1649455928%22%20id%3D%22toc-hId-1649455928%22%3EGetting%20started%3C%2FH3%3E%0A%3CP%3ELet's%20start%20by%20setting%20up%20our%20computer%20with%20all%20the%20requirements%20needed%20to%20build%20React%20Native%20applications%20for%20Windows.%20The%20first%20one%20is%20Visual%20Studio%202019%20with%20the%20following%20workloads%20installed%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EUniversal%20Windows%20Platform%20development%20(make%20sure%20to%20enable%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EC%2B%2B%20(v142)%20Universal%20Windows%20Platform%20tools%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eoption)%3C%2FLI%3E%0A%3CLI%3EDesktop%20development%20with%20C%2B%2B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EMake%20sure%20also%20to%20check%2C%20in%20the%20Indivual%20components%20section%2C%20the%20following%20ones%20under%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECompilers%2C%20build%20tools%20and%20runtimes%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EMSVC%20v141%20-%20VS%202017%20C%2B%2B%20x64%2Fx86%20build%20tools%20(v14.16)%3C%2FLI%3E%0A%3CLI%3EMSVC%20v141%20-%20VS%202017%20C%2B%2B%20ARM%20build%20tools%20(v14.16)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ENow%20let's%20move%20to%20the%20%22web%20tools%22.%20The%20first%20one%20is%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ENodeJS%3C%2FSTRONG%3E%2C%20the%20JavaScript%20runtime%20built%20on%20top%20of%20the%20Chrome%20JavaScript%20engine.%20Everything%20around%20React%20Native%20(the%20core%2C%20libraries%2C%20etc.)%20is%20distributed%20as%20packages%20through%20the%20popular%20NPM%20package%20manager%2C%20so%20you'll%20need%20the%20NodeJS%20runtime%20to%20leverage%20it.%20You%20can%20get%20it%20from%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fnodejs.org%2Fen%2Fdownload%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eofficial%20website%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOptionally%20(but%20highly%20suggested)%20is%20to%20install%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EYarn%3C%2FSTRONG%3E%2C%20a%20package%20manager%20for%20Node.%20As%20we're%20going%20to%20see%20in%20the%20next%20steps%2C%20it%20will%20help%20us%20a%20lot%20in%20setting%20up%20the%20whole%20environment.%20You%20can%20download%20it%20from%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fyarnpkg.com%2Fen%2Fdocs%2Finstall%23windows-stable%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethe%20official%20website%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELast%20but%20not%20the%20least%2C%20if%20you%20want%20to%20debug%20your%20application%20you%20will%20need%20to%20leverage%20the%20Developer%20Tools%20included%20in%20Chromium.%20The%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2Freact-native-windows%2Fblob%2Fmaster%2Fvnext%2Fdocs%2FGettingStarted.md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eofficial%20guidance%20on%20GitHub%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Especifically%20invites%20you%20to%20install%20Chrome%2C%20but%20also%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoftedgeinsider.com%2Fen-us%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethe%20new%20Edge%20based%20on%20Chromium%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eworks%20like%20a%20charm.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat's%20it!%20Now%20we%20can%20start%20to%20create%20our%20first%20React%20Native%20project.%20You%20can%20refer%20to%20the%20guidance%20provided%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2Freact-native-windows%2Fblob%2Fmaster%2Fvnext%2Fdocs%2FConsumingRNW.md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eon%20the%20GitHub%20repository%3C%2FA%3E.%20I%20won't%20repeat%20them%20here%20since%20the%20steps%20might%20change%20in%20the%20future%20(for%20example%2C%20the%20targeted%20React%20Native%20version%20has%20changed%20multiple%20times%20since%20the%20project%20started).%3C%2FP%3E%0A%3CP%3EThe%20last%20tool%20I'm%20going%20to%20mention%20isn't%20exactly%20a%20requirement%2C%20but%20a%20strong%20suggestion.%20In%20order%20to%20build%20your%20React%20Native%20application%20you%20will%20need%20to%20use%20an%20IDE.%20Sure%2C%20you%20can%20use%20also%20Notepad%2C%20but%20there%20are%20better%20options%20out%20there%2C%20like%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fcode.visualstudio.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EVisual%20Studio%20Code%3C%2FA%3E%2C%20which%20offers%20also%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmsjsdiag.vscode-react-native%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ean%20extension%20for%20React%20Native%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewhich%20gives%20you%20IntelliSense%2C%20debugging%2C%20etc.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3EMake%20sure%20to%20have%20plenty%20of%20space%20on%20your%20hard%20disk.%20Since%20the%20React%20Native%20implementation%20for%20Windows%20is%20based%20on%20C%2B%2B%2C%20the%20compilation%20artifacts%20will%20be%20quite%20big%2C%20so%20an%20average%20project's%20folder%20can%20easily%20reach%20the%20size%20of%205-6%20GB.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CH3%20id%3D%22running-your-react-native-for-windows-project%22%20id%3D%22toc-hId--902701033%22%20id%3D%22toc-hId--902701033%22%20id%3D%22toc-hId--902701033%22%3ERunning%20your%20React%20Native%20for%20Windows%20project%3C%2FH3%3E%0A%3CP%3EThe%20easiest%20way%20to%20launch%20your%20React%20Native%20for%20Windows%20project%20is%20to%20run%20the%20following%20command%20from%20your%20project's%20folder%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FBUTTON%3E%3CPRE%3E%3CBUTTON%3E%3CCODE%20class%3D%22language-bash%20hljs%22%3Ereact-native%20run-windows%0A%3C%2FCODE%3E%3C%2FBUTTON%3E%3C%2FPRE%3E%0A%3CP%3EIn%20the%20past%20there%20have%20been%20some%20issues%20that%20prevented%20this%20command%20to%20work%20properly.%20Most%20of%20them%20should%20be%20fixed%20now%20but%2C%20in%20case%20you're%20still%20hitting%20one%20of%20them%2C%20here%20is%20an%20alternative%20procedure%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%0A%3CP%3EOpen%20in%20File%20Explorer%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ewindows%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder%20inside%20the%20folder%20which%20contains%20your%20React%20Native%20project.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EOpen%20the%20Visual%20Studio%20solution%20you'll%20find%20there.%20The%20name%20of%20the%20solution%20will%20match%20the%20name%20of%20the%20project.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EThe%20solution%20is%20made%20by%20different%20projects%2C%20all%20based%20on%20C%2B%2B.%20The%20main%20one%20(which%20contains%20the%20actual%20application%20to%20deploy)%20is%20the%20one%20which%20name%20matches%20with%20the%20React%20Native%20project's%20name.%20In%20our%20case%2C%20it's%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETodosFeed%3C%2FSTRONG%3E.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20352px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137402i84C385A5E1B5F763%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22ReactNativeSolution.png%22%20title%3D%22ReactNativeSolution.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3ECompile%20the%20whole%20solution%20(again%2C%20it%20will%20take%20a%20while%20because%20of%20the%20C%2B%2B%20projects)%2C%20then%20right%20click%20on%20the%20UWP%20project%20and%20choose%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EDeploy%3C%2FSTRONG%3E%3CSPAN%3E.%20Make%20sure%20that%2C%20in%20the%20configuration%20dropdown%2C%20you%20choose%20an%20architecture%20which%20is%20suitable%20for%20your%20computer%2C%20like%20x86%20or%20x64.%20The%20default%20value%2C%20in%20fact%2C%20will%20be%20ARM.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3EYou%20should%20always%20launch%20the%20UWP%20project%20either%20from%20the%20Start%20menu%20or%20by%20pressing%20CTRL-F5%20in%20Visual%20Studio%2C%20without%20attaching%20the%20debugger.%20The%20reason%20is%20that%2C%20in%20this%20scenario%2C%20the%20UWP%20app%20is%20just%20the%20%22host%22%20of%20the%20React%20Native%20application%2C%20so%20the%20real%20debugging%20must%20be%20done%20on%20the%20React%20code.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3EBefore%20launching%20the%20application%2C%20however%2C%20you%20have%20to%20manually%20run%20the%20React%20packager%20by%20typing%20the%20following%20command%20in%20the%20project's%20folder%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-bash%20hljs%22%3Eyarn%20start%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWhat%20is%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EReact%20packager%3C%2FSTRONG%3E%3F%20It%20takes%20care%20of%20a%20few%20important%20tasks%2C%20like%20translating%20JSX%20into%20code%20that%20the%20target%20platform%20will%20understand%20and%20combining%20all%20your%20JavaScript%20into%20a%20single%20file.%20When%20you're%20in%20development%20mode%2C%20the%20command%20prompt%20with%20the%20React%20packager%20must%20always%20be%20up%20%26amp%3B%20running.%20This%20way%2C%20every%20time%20you%20make%20a%20change%20to%20the%20code%20of%20your%20React%20Native%20application%2C%20the%20packager%20will%20automatically%20create%20a%20new%20bundle%20and%20refresh%20the%20application.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137403iA114E0A2A661DE94%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Packager.png%22%20title%3D%22Packager.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EOnce%20the%20packager%20is%20ready%2C%20it%20should%20automatically%20launch%20Chrome%20on%20the%20local%20server%20which%20is%20used%20to%20serve%20the%20React%20application.%20If%20it%20doesn't%20happen%2C%20you%20can%20open%20it%20manually%20(or%20you%20can%20launch%20Edge%20based%20on%20Chromium)%20and%20open%20the%20URL%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ehttp%3A%2F%2Flocalhost%3A8081%2Fdebugger-ui%2F%3C%2FSTRONG%3E%3CSPAN%3E.%20Then%20you%20can%20press%20F12%20or%20CTRL-SHIFT-J%20to%20turn%20on%20the%20developer%20tools%2C%20which%20will%20help%20you%20to%20see%20any%20error%20that%20might%20arise%20in%20the%20React%20Native%20application.%20This%20operation%20is%20very%20important%20because%2C%20if%20the%20local%20development%20server%20isn't%20up%20%26amp%3B%20running%2C%20the%20UWP%20application%20won't%20be%20able%20to%20render%20the%20React%20Native%20content%20and%20you%20will%20get%20an%20error%20like%20the%20following%20one%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137404iFEEBC53874D5F14D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22InstanceFailedToStart.png%22%20title%3D%22InstanceFailedToStart.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ENow%20that%20both%20the%20packager%20and%20the%20development%20server%20are%20up%20%26amp%3B%20running%2C%20you%20can%20launch%20the%20UWP%20application%20you%20have%20deployed.%20If%20you%20did%20everything%20well%2C%20you%20will%20see%20the%20packager%20starting%20to%20serve%20the%20various%20files%20in%20the%20command%20prompt%20and%2C%20in%20the%20UWP%20application%2C%20you%20will%20see%20the%20default%20React%20Native%20starter%20template.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137405i2B24A3A27C9FAB9C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22ReactNativeTemplate.png%22%20title%3D%22ReactNativeTemplate.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22using-react-native-to-build-a-full-uwp-application%22%20id%3D%22toc-hId-840109302%22%20id%3D%22toc-hId-840109302%22%20id%3D%22toc-hId-840109302%22%3EUsing%20React%20Native%20to%20build%20a%20full%20UWP%20application%3C%2FH3%3E%0A%3CP%3EThis%20is%20the%20simplest%20task%2C%20since%20with%20all%20the%20steps%20we%20have%20taken%20so%20far%20we%20have%20already%20created%20a%20full%20UWP%20application%20based%20on%20React%20Native.%20Let's%20try%20to%20create%20a%20more%20realistic%20one%20compared%20to%20the%20default%20template%2C%20which%20we're%20going%20to%20reuse%20for%20the%20next%20scenarios.%20As%20already%20mentioned%2C%20the%20UWP%20app%20is%20just%20the%20host%20of%20the%20React%20Native%20one%2C%20so%20to%20start%20actually%20coding%20you%20need%20to%20open%20the%20React%20Native%20project's%20folder%20with%20Visual%20Studio%20Code.%20Just%20right%20click%20on%20the%20folder%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EOpen%20with%20Visual%20Studio%20Code%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eor%2C%20alternatively%2C%20if%20you're%20still%20in%20the%20command%20prompt%2C%20type%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-bash%20hljs%22%3Ecode%20.%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EAs%20mentioned%2C%20the%20default%20page%20you%20see%20in%20the%20application%20is%20defined%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EApp.js%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile.%20Let's%20replace%20the%20default%20content%20with%20a%20simple%20application%20that%20displays%20a%20list%20of%20to-dos%2C%20downloaded%20from%20a%20REST%20service.%20This%20will%20be%20the%20final%20look%20%26amp%3B%20feel%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20585px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137406i77B08C39915A1520%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22TodosApp.png%22%20title%3D%22TodosApp.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENothing%20too%20complex%2C%20but%20enough%20to%20play%20with%20the%20React%20Native%20and%20Windows%20capabilities.%3C%2FP%3E%0A%3CP%3ELet's%20start%20by%20building%20a%20component%20that%20will%20display%20the%20list%20of%20to-dos.%20Create%20a%20new%20folder%20in%20the%20project%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ecomponents%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%2C%20inside%20it%2C%20create%20a%20file%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETodosList.js%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3EFirst%2C%20let's%20import%20the%20required%20controls%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-javascript%20hljs%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Eimport%3C%2FSPAN%3E%20React%2C%20%7B%20Component%20%7D%20%3CSPAN%20class%3D%22hljs-keyword%22%3Efrom%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'react'%3C%2FSPAN%3E%3B%0A%3CSPAN%20class%3D%22hljs-keyword%22%3Eimport%3C%2FSPAN%3E%20%7B%0A%20%20ActivityIndicator%2C%0A%20%20View%2C%0A%20%20FlatList%2C%0A%20%20Text%0A%7D%20%3CSPAN%20class%3D%22hljs-keyword%22%3Efrom%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'react-native'%3C%2FSPAN%3E%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWe're%20going%20to%20use%20four%20controls%20from%20React%20Native%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CCODE%3EActivityIndicator%3C%2FCODE%3E%2C%20to%20display%20a%20loading%20icon%20when%20the%20data%20is%20being%20downloaded%20from%20the%20REST%20service.%3C%2FLI%3E%0A%3CLI%3E%3CCODE%3EView%3C%2FCODE%3E%2C%20which%20is%20the%20basic%20container%20of%20React%20Native.%20Typically%2C%20it's%20the%20main%20entry%20point%20which%20contains%2C%20as%20child%2C%20the%20other%20controls.%20Think%20of%20it%20like%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EPage%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Econtrol%20in%20XAML.%3C%2FLI%3E%0A%3CLI%3E%3CCODE%3EFlatList%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20display%20the%20list%20of%20to-dos%20we%20have%20downloaded.%3C%2FLI%3E%0A%3CLI%3E%3CCODE%3EText%3C%2FCODE%3E%2C%20to%20display%20a%20text.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ELet's%20start%20to%20define%20our%20component%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-javascript%20hljs%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Eimport%3C%2FSPAN%3E%20React%2C%20%7B%20Component%20%7D%20%3CSPAN%20class%3D%22hljs-keyword%22%3Efrom%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'react'%3C%2FSPAN%3E%3B%0A%3CSPAN%20class%3D%22hljs-keyword%22%3Eimport%3C%2FSPAN%3E%20%7B%0A%20%20ActivityIndicator%2C%0A%20%20View%2C%0A%20%20FlatList%0A%7D%20%3CSPAN%20class%3D%22hljs-keyword%22%3Efrom%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'react-native'%3C%2FSPAN%3E%3B%0A%0A%3CSPAN%20class%3D%22hljs-class%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Eclass%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-title%22%3ETodosList%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3Eextends%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-title%22%3EComponent%3C%2FSPAN%3E%20%3C%2FSPAN%3E%7B%0A%0A%20%20render()%20%7B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ereturn%3C%2FSPAN%3E(%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22xml%22%3E%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EView%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EActivityIndicator%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3Esize%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22large%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EFlatList%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3EView%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20)%3B%0A%20%20%7D%0A%7D%0A%0Aexport%20default%20TodosList%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThis%20is%20the%20basic%20skeleton%2C%20since%20the%20component%20doesn't%20actually%20include%20any%20data%20or%20any%20action.%20The%20component%20is%20defined%20using%20the%20standard%20React%20Native%20syntax%20based%20on%20ES6%2C%20the%20latest%20definition%20of%20the%20JavaScript%20language.%20We%20create%20a%20new%20class%20which%20extends%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EComponent%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eone%2C%20which%20is%20provided%20by%20the%20React%20library.%20The%20component%20defines%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Erender()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Emethod%2C%20which%20include%20the%20JSX%20that%20represents%20the%20UI.%20The%20current%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EView%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Econtains%20an%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EActivityIndicator%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EFlatList%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewhich%2C%20however%2C%20we%20need%20to%20populate%20with%20some%20data.%3C%2FP%3E%0A%3CP%3ELet's%20enhance%20our%20component%20with%20some%20new%20code%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-javascript%20hljs%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Eimport%3C%2FSPAN%3E%20React%2C%20%7B%20Component%20%7D%20%3CSPAN%20class%3D%22hljs-keyword%22%3Efrom%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'react'%3C%2FSPAN%3E%3B%0A%3CSPAN%20class%3D%22hljs-keyword%22%3Eimport%3C%2FSPAN%3E%20%7B%0A%20%20ActivityIndicator%2C%0A%20%20View%2C%0A%20%20FlatList%0A%7D%20%3CSPAN%20class%3D%22hljs-keyword%22%3Efrom%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'react-native'%3C%2FSPAN%3E%3B%0A%0A%3CSPAN%20class%3D%22hljs-class%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Eclass%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-title%22%3ETodosList%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3Eextends%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-title%22%3EComponent%3C%2FSPAN%3E%20%3C%2FSPAN%3E%7B%0A%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Econstructor%3C%2FSPAN%3E(props)%20%7B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Esuper%3C%2FSPAN%3E(props)%3B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ethis%3C%2FSPAN%3E.state%20%3D%20%7B%20%3CSPAN%20class%3D%22hljs-attr%22%3Etodos%3C%2FSPAN%3E%3A%20%5B%5D%2C%20%3CSPAN%20class%3D%22hljs-attr%22%3Eloading%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22hljs-literal%22%3Efalse%3C%2FSPAN%3E%7D%3B%0A%20%20%7D%0A%0A%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Easync%3C%2FSPAN%3E%20componentDidMount()%20%7B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ethis%3C%2FSPAN%3E.setState(%20%7B%20%3CSPAN%20class%3D%22hljs-attr%22%3Eloading%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22hljs-literal%22%3Etrue%3C%2FSPAN%3E%7D)%3B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Evar%3C%2FSPAN%3E%20result%20%3D%20%3CSPAN%20class%3D%22hljs-keyword%22%3Eawait%3C%2FSPAN%3E%20fetch(%3CSPAN%20class%3D%22hljs-string%22%3E%22https%3A%2F%2Fjsonplaceholder.typicode.com%2Ftodos%22%3C%2FSPAN%3E)%3B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Evar%3C%2FSPAN%3E%20json%20%3D%20%3CSPAN%20class%3D%22hljs-keyword%22%3Eawait%3C%2FSPAN%3E%20result.json()%3B%0A%20%20%20%20%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ethis%3C%2FSPAN%3E.setState(%20%7B%20%3CSPAN%20class%3D%22hljs-attr%22%3Etodos%3C%2FSPAN%3E%3A%20json.slice(%3CSPAN%20class%3D%22hljs-number%22%3E1%3C%2FSPAN%3E%2C%3CSPAN%20class%3D%22hljs-number%22%3E20%3C%2FSPAN%3E)%2C%20%3CSPAN%20class%3D%22hljs-attr%22%3Eloading%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22hljs-literal%22%3Efalse%3C%2FSPAN%3E%7D)%3B%0A%20%20%7D%0A%0A%20%20render()%20%7B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ereturn%3C%2FSPAN%3E(%0A%20%20%20%20%20%20%3CVIEW%3E%0A%20%20%20%20%20%20%20%20%3CACTIVITYINDICATOR%20size%3D%22large%22%20animating%3D%22%7Bthis.state.loading%7D%22%3E%3C%2FACTIVITYINDICATOR%3E%0A%20%20%20%20%20%20%20%20%3CFLATLIST%20data%3D%22%7Bthis.state.todos%7D%22%20renderitem%3D%22%7B(%7Bitem%7D)%22%3E%20%3CTEXT%20id%3D%22%7Bitem.id%7D%22%3E%7Bitem.title%7D%3C%2FTEXT%3E%7D%20%2F%26gt%3B%20%0A%20%20%20%20%20%20%3C%2FFLATLIST%3E%0A%20%20%20%20)%3B%0A%20%20%7D%0A%7D%0A%0Aexport%20default%20TodosList%0A%3C%2FVIEW%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EFirst%20we%20need%20to%20introduce%20one%20of%20the%20most%20important%20concepts%20in%20React%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Estate%3C%2FSTRONG%3E.%20It's%20a%20key%20-%20value%20pair%20collection%20where%20we%20can%20store%20data%20that%20must%20be%20displayed%20by%20the%20user%20interface.%20The%20nice%20bonus%20of%20the%20state%20management%20in%20React%20is%20that%20it%20automatically%20keeps%20the%20UI%20in%20sync.%20Whenever%20you're%20going%20to%20change%20one%20of%20the%20values%20stored%20in%20the%20state%2C%20every%20UI%20component%20connected%20to%20that%20value%20will%20be%20automatically%20updated.%20If%20you're%20a%20XAML%20developer%2C%20this%20concept%20should%20be%20familiar%20to%20you%20since%20it's%20similar%20to%20binding.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20define%20the%20state%20in%20the%20constructor%20of%20the%20component%20and%20we%20setup%20two%20properties%3A%20one%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etodos%3C%2FCODE%3E%2C%20which%20is%20an%20array%20that%20will%20store%20our%20collection%20of%20to-dos%3B%20the%20other%20one%20is%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eloading%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20it's%20a%20boolean%20we're%20going%20to%20use%20to%20hide%20%2F%20display%20the%20loading%20indicator.%3C%2FP%3E%0A%3CP%3ENow%20that%20we%20have%20a%20place%20where%20to%20store%20our%20to-dos%2C%20we%20need%20to%20download%20them%20when%20the%20component%20is%20rendered.%20To%20achieve%20this%20goal%20we%20leverage%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EcomponentDidMount()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Emethod%2C%20which%20is%20one%20of%20the%20many%20available%20functions%20to%20handle%20the%20lifecycle%20of%20a%20component.%20Inside%20the%20function%20we%20use%20the%20JavaScript%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdevelopers.google.com%2Fweb%2Fupdates%2F2015%2F03%2Fintroduction-to-fetch%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Efetch%20API%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20download%20the%20list%20of%20to-dos%20from%20a%20REST%20service.%20We're%20using%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fjsonplaceholder.typicode.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fjsonplaceholder.typicode.com%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eas%20endpoint%2C%20which%20is%20a%20service%20that%20returns%20fake%20data%20for%20testing%20and%20development%20purposes.%20The%20fetch%20API%20is%20asynchronous%2C%20so%20we%20use%20the%20async%20%2F%20await%20approach%20(supported%20by%20all%20the%20modern%20browsers%20nowadays)%20to%20handle%20it.%20In%20the%20end%20we%20convert%20the%20response%20into%20a%20JSON%20object%20by%20calling%20another%20asynchronous%20method%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Ejson()%3C%2FCODE%3E%2C%20and%20we%20store%20the%20result%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etodos%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eobject%20in%20the%20state.%20We%20also%20change%20the%20value%20of%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eloading%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%2C%20so%20that%20we%20can%20hide%20the%20loading%20indicator.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20notice%20two%20things%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ETo%20set%20the%20state%2C%20we%20are%20using%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EsetState()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Emethod%20instead%20of%20setting%20it%20directly.%20This%20is%20required%20to%20enable%20the%20sync%2C%20otherwise%20the%20UI%20won't%20be%20notified%20that%20the%20value%20of%20one%20of%20the%20properties%20has%20changed.%3C%2FLI%3E%0A%3CLI%3EWe%20use%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eslice()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Emethod%20to%20take%20only%20the%20first%2020%20items%20from%20the%20result.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ENow%20that%20we%20have%20some%20real%20data%20inside%20the%20state%2C%20we%20can%20populate%20the%20UI%20controls%20we%20have%20previously%20created%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%0A%3CP%3EWe%20connect%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eanimating%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%20of%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EActivityIndicator%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Econtrol%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eloading%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%20stored%20in%20the%20state%20(%3CCODE%3Ethis.state.loading%3C%2FCODE%3E).%20This%20way%2C%20the%20loading%20indicator%20will%20be%20displayed%20when%20we%20start%20the%20operation%20and%20hidden%20when%20the%20data%20from%20the%20REST%20service%20has%20been%20downloaded.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EWe%20connect%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Edata%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%20of%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EFlatList%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Econtrol%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etodos%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%20stored%20in%20the%20state%20(%3CCODE%3Ethis.state.todos%3C%2FCODE%3E).%20This%20way%2C%20the%20list%20will%20be%20automatically%20populated%20with%20all%20the%20items%20that%20have%20been%20downloaded%20from%20the%20REST%20service.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EWe%20use%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3ErenderItem%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%20of%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EFlatList%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Econtrol%20to%20define%20how%20every%20single%20item%20of%20the%20list%20should%20be%20rendered.%20We%20express%20this%20property%20using%20a%20lambda%20expression%2C%20which%20gives%20us%20a%20reference%20to%20a%20single%20to-do%20in%20the%20list.%20For%20the%20moment%20we%20use%20a%20simple%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EText%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Econtrol%20and%2C%20inside%20it%2C%20we%20display%20the%20value%20of%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etext%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%20of%20the%20to-do.%20We%20can%20understand%20where%20this%20property%20is%20coming%20from%20by%20opening%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fjsonplaceholder.typicode.com%2Ftodos%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethe%20URL%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eof%20the%20REST%20API%20in%20a%20browser%20or%20in%20a%20tool%20like%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.getpostman.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPostman%3C%2FA%3E.%20We%20will%20see%20that%20each%20item%20inside%20the%20collection%20has%20the%20following%20properties%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EuserId%3C%2FLI%3E%0A%3CLI%3Eid%3C%2FLI%3E%0A%3CLI%3Etitle%3C%2FLI%3E%0A%3CLI%3Ecompleted%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAs%20such%2C%20from%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eitem%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eobject%20we%20can%20directly%20access%20to%20each%20of%20them.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20that%20we%20have%20defined%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3ETodosList%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ecomponent%2C%20we%20need%20to%20display%20it%20in%20replacement%20of%20the%20original%20React%20Native%20template.%20Move%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EApp.js%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20and%2C%20inside%20the%20class%20which%20defines%20the%20main%20component%2C%20change%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Erender()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Emethod%20to%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-javascript%20hljs%22%3E%3CSPAN%20class%3D%22hljs-class%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Eclass%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-title%22%3ETodosFeed%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3Eextends%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-title%22%3EComponent%3C%2FSPAN%3E%20%3C%2FSPAN%3E%7B%0A%20%20render()%20%7B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ereturn%3C%2FSPAN%3E%20(%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22xml%22%3E%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EView%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3Estyle%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%7Bstyles.container%7D%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EText%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3Estyle%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%7Bstyles.welcome%7D%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3ETo-dos%3CSPAN%20class%3D%22hljs-tag%22%3EText%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3ETodosList%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3EView%3C%2FSPAN%3E%26gt%3B%0A%20%20%20%20)%3B%0A%20%20%7D%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThat's%20it!%20Now%20make%20sure%20that%20the%20React%20packager%20is%20still%20up%20%26amp%3B%20running%20and%20that%20Edge%20%2F%20Chrome%20is%20open%20on%20the%20developer%20tools.%20The%20UWP%20application%20should%20update%20itself%20and%20you%20should%20see%20the%20list%20of%20to-dos%20being%20downloaded%20and%20rendered%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20585px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137407i50C3510DB630786A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22TodosFirstVersion.png%22%20title%3D%22TodosFirstVersion.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThe%20controls%20we%20have%20defined%20using%20JSX%20have%20been%20translated%20into%20native%20UWP%20controls%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CCODE%3EText%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20now%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3ETextBlock%3C%2FCODE%3E%3C%2FLI%3E%0A%3CLI%3E%3CCODE%3EActivityIndicator%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20now%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EProgressRing%3C%2FCODE%3E%3C%2FLI%3E%0A%3CLI%3E%3CCODE%3EFlatList%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20now%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EListView%3C%2FCODE%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20nice%20benefit%20of%20the%20live%20debugger%20is%20that%20you%20won't%20have%20to%20redeploy%20the%20UWP%20application%20every%20time%20you%20make%20a%20change.%20Just%20change%20something%20in%20the%20React%20Native%20code%20in%20Visual%20Studio%20Code%2C%20hit%20save%20and%20the%20content%20of%20the%20UWP%20app%20will%20be%20reloaded%20to%20display%20the%20updates.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat's%20it!%20We%20have%20our%20first%20React%20Native%20application%20running%20in%20Windows%20as%20a%20full%20UWP%20application!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22embedding-the-react-native-component-inside-a-uwp-app%22%20id%3D%22toc-hId--1712047659%22%20id%3D%22toc-hId--1712047659%22%20id%3D%22toc-hId--1712047659%22%3EEmbedding%20the%20React%20Native%20component%20inside%20a%20UWP%20app%3C%2FH3%3E%0A%3CP%3ELet's%20move%20to%20the%20next%20step%20and%20see%20another%20scenario.%20What%20if%20we%20want%20to%20use%20the%20React%20Native%20component%20we%20have%20just%20built%20not%20as%20part%20of%20a%20full%20React%20Native%20application%2C%20but%20inside%20an%20existing%20UWP%20application%3F%20You%20may%20have%20a%20UWP%20application%20already%20in%20development%2C%20but%20you%20may%20want%20to%20integrate%20a%20React%20Native%20component%20built%20by%20the%20mobile%20team%20for%20the%20Android%20and%20iOS%20versions%20of%20the%20same%20app.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20start!%20The%20first%20step%20is%20to%20move%20the%20React%20Native%20component%20we%20have%20built%20before%20from%20a%20full%20UWP%20app%20to%20a%20custom%20control%2C%20that%20can%20be%20reused%20in%20other%20UWP%20applications.%20Open%20the%20solution%20created%20by%20the%20React%20Native%20for%20Windows%20CLI%20(you'll%20find%20it%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ewindows%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder%20of%20your%20project).%20Then%20right%20click%20on%20it%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%20%E2%86%92%20New%20project%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20select%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EWindows%20Runtime%20Component%20(Universal%20Windows)%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etemplate%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137408i3425A04D7548A594%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22WindowsRuntimeComponent.png%22%20title%3D%22WindowsRuntimeComponent.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20case%20I'm%20building%20a%20C%23%20component%20since%20it's%20the%20language%20I'm%20most%20familiar%20with.%20However%2C%20you%20could%20use%20the%20C%2B%2B%20template%20as%20well%20since%2C%20other%20than%20setting%20up%20the%20React%20Native%20infrastructure%2C%20we%20aren't%20actually%20going%20to%20build%20something.%20All%20the%20content%20displayed%20in%20this%20control%20will%20be%20provided%20by%20the%20React%20Native%20implementation.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFeel%20free%20to%20delete%20the%20default%20class%20that%20is%20included%20in%20the%20project%2C%20then%20right%20click%20on%20it%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%20%E2%86%92%20New%20item%3C%2FSTRONG%3E.%20Pick%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EUser%20control%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efrom%20the%20list%20and%20give%20it%20a%20meaningful%20name%2C%20like%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETodosFeedControl.xaml%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3ENow%20we%20need%20to%20include%20inside%20the%20newly%20created%20user%20control%20the%20React%20Native%20for%20Windows%20initialization.%20As%20first%20thing%2C%20right%20click%20on%20the%20project%2C%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%20%E2%86%92%20Reference%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20pick%20up%20from%20the%20list%20the%20project%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EReactUWP%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20that%20the%20React%20Native%20for%20Windows%20runtime%20is%20referenced%2C%20we%20need%20to%20add%20in%20the%20XAML%20file%20the%20control%20which%20will%20host%20the%20React%20Native%20application.%20First%2C%20let's%20declare%20the%20relevant%20namespace%20in%20user%20control%20definition%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-xml%20hljs%22%3Exmlns%3Areact%3D%22using%3Areact.uwp%22%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThen%2C%20inside%20the%20main%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EGrid%3C%2FCODE%3E%2C%20you%20need%20to%20add%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EReactControl%3C%2FCODE%3E%2C%20which%20is%20part%20of%20the%20namespace%20you%20have%20just%20declared%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-xml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EGrid%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3Ereact%3AReactControl%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3Ex%3AName%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22RootElement%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-tag%22%3EGrid%3C%2FSPAN%3E%26gt%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3ENow%20let's%20move%20to%20the%20code-behind%20class%20of%20the%20user%20control.%20We%20need%20to%20add%20some%20code%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-csharp%20hljs%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Epublic%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3Esealed%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3Epartial%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3Eclass%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-title%22%3ETodosFeedControl%3C%2FSPAN%3E%20%3A%20%3CSPAN%20class%3D%22hljs-title%22%3EUserControl%3C%2FSPAN%3E%0A%7B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Econst%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3Estring%3C%2FSPAN%3E%20JSFILENAME%20%3D%20%3CSPAN%20class%3D%22hljs-string%22%3E%22index%22%3C%2FSPAN%3E%3B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Econst%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3Estring%3C%2FSPAN%3E%20JSCOMPONENTNAME%20%3D%20%3CSPAN%20class%3D%22hljs-string%22%3E%22TodosFeed%22%3C%2FSPAN%3E%3B%0A%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-function%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Epublic%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-title%22%3ETodosFeedControl%3C%2FSPAN%3E()%3C%2FSPAN%3E%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ethis%3C%2FSPAN%3E.InitializeComponent()%3B%0A%20%20%20%20%20%20%20%20LoadReact()%3B%0A%20%20%20%20%7D%0A%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-function%22%3E%3CSPAN%20class%3D%22hljs-keyword%22%3Epublic%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3Evoid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-title%22%3ELoadReact%3C%2FSPAN%3E()%3C%2FSPAN%3E%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20InstanceSettings%20settings%3B%0A%0A%20%20%20%20%20%20%20%20settings.UseLiveReload%20%3D%20%3CSPAN%20class%3D%22hljs-literal%22%3Etrue%3C%2FSPAN%3E%3B%0A%20%20%20%20%20%20%20%20settings.UseWebDebugger%20%3D%20%3CSPAN%20class%3D%22hljs-literal%22%3Etrue%3C%2FSPAN%3E%3B%0A%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Evar%3C%2FSPAN%3E%20instance%20%3D%20Instance.Create(JSFILENAME)%3B%0A%20%20%20%20%20%20%20%20instance.Start(settings)%3B%0A%20%20%20%20%20%20%20%20RootElement.Instance%20%3D%20instance%3B%0A%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Estring%3C%2FSPAN%3E%20initialProps%20%3D%20%3CSPAN%20class%3D%22hljs-string%22%3E%22%7B%20%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2B%20%3CSPAN%20class%3D%22hljs-string%22%3E%22%5C%22one%5C%22%3A%5C%221%5C%22%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2B%20%3CSPAN%20class%3D%22hljs-string%22%3E%22%2C%20%5C%22two%5C%22%3A%5C%222%5C%22%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2B%20%3CSPAN%20class%3D%22hljs-string%22%3E%22%7D%22%3C%2FSPAN%3E%3B%0A%0A%20%20%20%20%20%20%20%20RootElement.InitialProps%20%3D%20initialProps%3B%0A%0A%20%20%20%20%20%20%20%20RootElement.JsComponentName%20%3D%20JSCOMPONENTNAME%3B%0A%20%20%20%20%20%20%20%20RootElement.StartRender()%3B%0A%20%20%20%20%7D%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThis%20is%20boilerplate%20code%20to%20initialize%20React%20Native%20for%20Windows.%20The%20only%20relevant%20parts%20to%20highlight%20are%20the%20two%20constants%20declared%20at%20the%20top%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CCODE%3EJSFILENAME%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edefines%20the%20name%20of%20the%20JavaScript%20file%20which%20contains%20the%20starting%20point%20of%20the%20React%20Native%20app%2C%20without%20the%20.js%20extension.%20In%20our%20case%2C%20it's%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eindex%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile.%3C%2FLI%3E%0A%3CLI%3E%3CCODE%3EJSCOMPONENTNAME%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edefines%20the%20name%20of%20the%20component%20which%20acts%20as%20a%20starting%20point%20of%20the%20application.%20This%20string%20must%20match%20the%20name%20of%20the%20project%3B%20in%20our%20case%20it's%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETodosFeed%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThat's%20it!%20Now%20we%20have%20a%20component%20that%20we%20can%20leverage%20in%20a%20full%20UWP%20application.%20Let's%20try%20this%20but%2C%20instead%20of%20using%20a%20basic%20UWP%20app%2C%20let's%20use%20a%20real%20one%2C%20to%20make%20things%20more%20interesting.%20We're%20going%20to%20use%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2FInventorySample%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EXAML%20VanArsdel%20Inventory%20Sample%3C%2FA%3E%2C%20which%20is%20an%20open-source%20project%20developed%20by%20Microsoft%20to%20showcase%20the%20usage%20of%20the%20latest%20and%20greatest%20XAML%20controls%20in%20a%20real%20product.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137409iAAA275A7C58E9C97%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22InventoryApp.png%22%20title%3D%22InventoryApp.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20first%20step%2C%20clone%20or%20download%20the%20project%20on%20your%20computer%2C%20then%20open%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EInventory.sln%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esolution.%20Now%20we%20need%20to%20add%20a%20reference%20to%20the%20user%20control%20we%20have%20just%20created.%20However%2C%20since%20the%20React%20Native%20for%20Windows%20implementation%20isn't%20stored%20in%20a%20library%20or%20in%20a%20NuGet%20package%2C%20we'll%20need%20to%20reference%20also%20the%20same%20C%2B%2B%20project%20that%20are%20referenced%20by%20the%20UWP%20application%20which%20hosts%20React%20Native.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20keep%20things%20cleaner%2C%20I%20decided%20to%20create%20a%20solution%20folder%20(right%20click%20on%20the%20solution%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%20%E2%86%92%20New%20Solution%20Folder%3C%2FSTRONG%3E)%2C%20where%20to%20store%20all%20the%20project%20related%20to%20React%20Native.%20Once%20you%20have%20created%20it%2C%20right%20click%20on%20it%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%20%E2%86%92%20Existing%20project%3C%2FSTRONG%3E.%20You%20will%20need%20to%20reference%20the%20following%205%20projects%2C%20which%20are%20all%20stored%20in%20the%20folder%20that%20contains%20the%20React%20Native%20project.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EFolly%3C%2FSTRONG%3E%2C%20which%20is%20included%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Enode_modules%5Creact-native-windows%5CFolly%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EReactUWP%3C%2FSTRONG%3E%2C%20which%20is%20included%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Enode_modules%5Creact-native-windows%5CReactUWP%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EReactCommon%3C%2FSTRONG%3E%2C%20which%20is%20included%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Enode_modules%5Creact-native-windows%5CReactCommon%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EReactWindowsCore%3C%2FSTRONG%3E%2C%20which%20is%20included%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Enode_modules%5Creact-native-windows%5CReactWindowsCore%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAll%20the%20previous%20project%20files%20will%20have%20the%20extension%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E.vcxproj%3C%2FSTRONG%3E%2C%20since%20they're%20based%20on%20C%2B%2B.%20The%20last%20and%20fifth%20project%20to%20reference%20is%20the%20one%20we%20have%20just%20created%20to%20store%20our%20user%20control.%20In%20my%20case%2C%20it's%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETodosFeed.Component%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20it's%20stored%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ewindows%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder.%20This%20project's%20file%20extension%20will%20be%2C%20instead%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E.csproj%3C%2FSTRONG%3E%2C%20since%20it's%20based%20on%20C%23.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20is%20how%20your%20solution%20should%20look%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20444px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137410i682B238DB32BC79F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22InventorySolution.png%22%20title%3D%22InventorySolution.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ENow%20we%20have%20everything%20we%20need!%20We%20can%20right%20click%20on%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EInventory.App%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bproject%2C%20choose%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%20%E2%86%92%20Reference%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Band%20select%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETodosFeed.Component%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bproject.%20We're%20going%20to%20add%20our%20React%20Native%20component%20in%20the%20main%20dashboard%20of%20the%20application%2C%20along%20with%20the%20other%20widgets.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137411iBC5AD41E6B6D4189%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Dashboard.png%22%20title%3D%22Dashboard.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20can%20find%20the%20dashboard%20definition%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EViews%20%E2%86%92%20Dashboard%20%E2%86%92%20DashboardView.xaml%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile.%20Let's%20first%20add%20the%20namespace%20of%20our%20user%20control%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-xml%20hljs%22%3Exmlns%3Areact%3D%22using%3ATodosFeed.Component%22%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThe%20page%20contains%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EGridView%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Econtrol%20with%20different%20panels%20declared%20as%20children.%20Let's%20add%20a%20new%20one%20at%20the%20end%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-xml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3Ereact%3ATodosFeedControl%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EMargin%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%2212%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EWidth%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22400%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EHeight%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22250%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThis%20is%20how%20the%20full%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EGridView%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edefinition%20should%20look%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-xml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EGridView%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EGrid.Row%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%222%22%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EMargin%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%226%22%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EItemContainerStyle%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BStaticResource%20GridItemStyle%7D%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3ESelectionMode%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22None%22%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EIsItemClickEnabled%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22True%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EItemClick%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22OnItemClick%22%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EGridView.ItemsPanel%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EItemsPanelTemplate%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3Econtrols%3AWrapPanel%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3EItemsPanelTemplate%3C%2FSPAN%3E%26gt%3B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3EGridView.ItemsPanel%3C%2FSPAN%3E%26gt%3B%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3Eviews%3ACustomersPane%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EMargin%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%2212%22%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EWidth%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22600%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EHeight%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22250%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EItemsSource%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7Bx%3ABind%20ViewModel.Customers%2C%20Mode%3DOneWay%7D%22%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3ETag%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22Customers%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3Eviews%3AProductsPane%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EMargin%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%2212%22%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EWidth%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22400%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EHeight%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22250%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EItemsSource%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7Bx%3ABind%20ViewModel.Products%2C%20Mode%3DOneWay%7D%22%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3ETag%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22Products%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3Eviews%3AOrdersPane%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EMargin%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%2212%22%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EWidth%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22400%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EHeight%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22250%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EItemsSource%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7Bx%3ABind%20ViewModel.Orders%2C%20Mode%3DOneWay%7D%22%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3ETag%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22Orders%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3Ereact%3ATodosFeedControl%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EMargin%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%2212%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EWidth%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22400%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EHeight%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22250%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-tag%22%3EGridView%3C%2FSPAN%3E%26gt%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThat's%20it.%20The%20user%20control%20we%20have%20just%20added%20contains%20all%20the%20logic%20required%20to%20initialize%20the%20React%20Native%20component%2C%20so%20we%20don't%20need%20to%20do%20anything%20else%20other%20adding%20it%20to%20the%20XAML%20page.%3C%2FP%3E%0A%3CP%3ENow%20it's%20time%20to%20build%20and%20deploy%20the%20application.%20Before%20doing%20it%2C%20however%2C%20we%20need%20to%20make%20sure%20that%20the%20React%20packager%20is%20up%20%26amp%3B%20running%2C%20otherwise%20the%20React%20Native%20component%20won't%20be%20rendered.%20As%20such%2C%20make%20sure%20that%20you%20have%20launched%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eyarn%20start%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ecommand%20on%20the%20React%20Native%20project%20and%20that%20your%20browser%20is%20opened%20on%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ehttp%3A%2F%2Flocalhost%3A8081%2Fdebugger-ui%2F%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3EURL.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20done%20everything%20correctly%2C%20after%20logging%20in%20on%20the%20dashboard%20you%20should%20see%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137412i723E857C4BB6B948%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22DashboardWithReact.png%22%20title%3D%22DashboardWithReact.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EVoil%C3%A0!%20Now%20our%20React%20Native%20component%20is%20being%20rendered%20inside%20the%20dashboard%2C%20along%20all%20the%20other%20native%20UWP%20controls.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22embedding-the-react-native-component-inside-a-win32-app%22%20id%3D%22toc-hId-30762676%22%20id%3D%22toc-hId-30762676%22%20id%3D%22toc-hId-30762676%22%3EEmbedding%20the%20React%20Native%20component%20inside%20a%20Win32%20app%3C%2FH3%3E%0A%3CP%3EThanks%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fapps%2Fdesktop%2Fmodernize%2Fxaml-islands%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EXAML%20Islands%3C%2FA%3E%2C%20we%20have%20the%20opportunity%20to%20embed%20inside%20a%20Win32%20application%20a%20UWP%20control%2C%20either%20built-in%20in%20the%20platform%20or%20a%20custom%20one%2C%20like%20the%20one%20we%20have%20just%20created%20to%20reuse%20our%20React%20Native%20control.%20Let's%20move%20on%20and%20add%20our%20component%20to%20a%20WPF%20application%20built%20on%20top%20of%20.NET%20Core%203.0%2C%20since%20it's%20the%20platform%20that%20provides%20the%20best%20compatibility%20with%20XAML%20Islands.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECreate%20a%20new%20solution%20in%20Visual%20Studio%202019%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EWPF%20(.NET%20Core)%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eas%20project's%20type%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137413i35EC7B35E5864881%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22WpfNetCore.png%22%20title%3D%22WpfNetCore.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20first%20step%2C%20you%20need%20to%20reference%20again%20all%20the%20projects%20required%20to%20run%20React%20Native%20and%20the%20user%20control%20we%20have%20created.%20These%20are%20the%20same%20ones%20we%20have%20added%20in%20the%20previous%20scenario%3A%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EFolly%3C%2FSTRONG%3E%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EReactCommon%3C%2FSTRONG%3E%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EReactUWP%3C%2FSTRONG%3E%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EReactWindowsCore%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20the%20custom%20control%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETodosFeed.Component%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20we%20need%20to%20setup%20the%20whole%20infrastructure%20required%20to%20support%20XAML%20Islands%20in%20a%20WPF%20application.%20The%20official%20documentation%20contains%20a%20very%20detailed%20step-by-step%20guide%2C%20which%20is%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fapps%2Fdesktop%2Fmodernize%2Fhost-custom-control-with-xaml-islands%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eavailable%20here%3C%2FA%3E.%20As%20such%2C%20I%20won't%20repeat%20all%20the%20required%20steps%20in%20this%20post.%20The%20only%20thing%20to%20pay%20attention%20is%20that%2C%20compared%20to%20the%20documentation%2C%20we%20already%20have%20a%20project%20which%20contains%20a%20custom%20control%20in%20our%20scenario.%20As%20such%2C%20you%20can%20skip%20the%20step%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECreate%20a%20custom%20UWP%20control%3C%2FSTRONG%3E.%20You%20just%20need%20to%20make%20sure%20to%20add%20to%20the%20project's%20file%20the%20two%20properties%20which%20are%20required%20to%20make%20it%20working%20with%20a%20Win32%20application.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERight%20click%20on%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETodosFeed.Component%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproject%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EUnload%20Project%3C%2FSTRONG%3E.%20Then%20right%20click%20on%20it%20again%20and%20choose%26nbsp%3BEdit.%20Create%20a%20new%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EPropertyGroup%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Einside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E%3CPROJECT%3E%3C%2FPROJECT%3E%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eelement%20with%20the%20following%20entries%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-xml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EPropertyGroup%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EEnableTypeInfoReflection%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3Efalse%3CSPAN%20class%3D%22hljs-tag%22%3EEnableTypeInfoReflection%3C%2FSPAN%3E%26gt%3B%0A%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EEnableXBindDiagnostics%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3Efalse%3CSPAN%20class%3D%22hljs-tag%22%3EEnableXBindDiagnostics%3C%2FSPAN%3E%26gt%3B%0A%3CSPAN%20class%3D%22hljs-tag%22%3EPropertyGroup%3C%2FSPAN%3E%26gt%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThen%20reload%20the%20project%20again%20and%20you%20will%20be%20good%20to%20go.%20Just%20remember%20to%20add%20a%20reference%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETodosFeed.Component%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproject%20both%20to%20the%20dummy%20UWP%20application%20and%20the%20WPF%20project.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22setup-the-wpf-project%22%20id%3D%22toc-hId-1577059506%22%20id%3D%22toc-hId-1577059506%22%20id%3D%22toc-hId-1577059506%22%3ESetup%20the%20WPF%20project%3C%2FH4%3E%0A%3CP%3EMicrosoft%20provides%20an%20easy%20way%20to%20integrate%20XAML%20Islands%20in%20a%20WPF%20application%20by%20offering%20a%20control%20that%20does%20most%20of%20the%20heavy-lifting%20for%20you.%20The%20control%20is%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EWindowsXamlHost%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20it's%20included%20in%20the%20Windows%20Community%20Toolkit.%20To%20use%20it%2C%20you%20need%20to%20add%20the%20NuGet%20package%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.nuget.org%2Fpackages%2FMicrosoft.Toolkit.Wpf.UI.XamlHost%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMicrosoft.Toolkit.Wpf.UI.XamlHost%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ein%20your%20WPF%20application.%3C%2FP%3E%0A%3CP%3EThe%20other%20step%20is%20to%20configure%20your%20solution%20to%20target%20a%20specific%20platform%2C%20since%20UWP%20controls%20can't%20target%20the%20generic%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAny%20CPU%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Earchitecture.%20As%20such%2C%20right%20click%20on%20the%20solution%20in%20Visual%20Studio%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EProperties%20%E2%86%92%20Configuration%20Properties%20%E2%86%92%20Configuration%20Manager%3C%2FSTRONG%3E.%20Under%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EActive%20solution%20platform%3C%2FSTRONG%3E%2C%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ENew%3C%2FSTRONG%3E%2C%20then%20add%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ex64%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eor%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ex86%3C%2FSTRONG%3E%2C%20as%20you%20prefer.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAll%20the%20projects%20in%20the%20dialog%20should%20list%2C%20under%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EPlatform%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ecolumn%2C%20the%20same%20architecture%20that%20is%20defined%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EActive%20solution%20platform%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edropdown.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20702px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137414i3487E2512F4215D2%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22CpuArchitecture.png%22%20title%3D%22CpuArchitecture.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22add-the-react-native-component%22%20id%3D%22toc-hId--975097455%22%20id%3D%22toc-hId--975097455%22%20id%3D%22toc-hId--975097455%22%3EAdd%20the%20React%20Native%20component%3C%2FH4%3E%0A%3CP%3ENow%20that%20the%20project%20is%20setup%20in%20the%20right%20way%2C%20you%20can%20add%20to%20your%20WPF%20application%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EWindowsXamlHost%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Econtrol%20we%20have%20previously%20included%20with%20the%20NuGet%20package.%20We're%20going%20to%20add%20it%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EMainPage.xaml%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20of%20the%20WPF%20application.%20First%2C%20you%20need%20to%20add%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EWindow%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eelement%20the%20following%20namespace%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-xml%20hljs%22%3Exmlns%3Axaml%3D%22clr-namespace%3AMicrosoft.Toolkit.Wpf.UI.XamlHost%3Bassembly%3DMicrosoft.Toolkit.Wpf.UI.XamlHost%22%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThen%20you%20can%20add%20the%20control%20inside%20the%20main%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EGrid%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eelement%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-xml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3Examl%3AWindowsXamlHost%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EInitialTypeName%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22TodosFeed.Component.TodosFeedControl%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThe%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EInitialTypeName%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%20is%20set%20with%20the%20full%20signature%20of%20the%20user%20control%20which%20hosts%20the%20React%20Native%20component.%3C%2FP%3E%0A%3CH4%20id%3D%22package-the-application-as-msix%22%20id%3D%22toc-hId-767712880%22%20id%3D%22toc-hId-767712880%22%20id%3D%22toc-hId-767712880%22%3EPackage%20the%20application%20as%20MSIX%3C%2FH4%3E%0A%3CP%3EThe%20easiest%20way%20to%20make%20sure%20that%20everything%20works%20in%20the%20right%20way%20with%20XAML%20Islands%20is%20to%20package%20the%20WPF%20application%20as%20MSIX.%20However%2C%20compared%20to%20a%20traditional%20application%2C%20there%20are%20some%20extra%20steps%20to%20take%2C%20in%20order%20to%20make%20sure%20that%20all%20the%20files%20are%20included%20in%20the%20package%20in%20the%20right%20way.%20Make%20sure%20to%20read%20the%20section%20titled%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EPackage%20the%20app%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fapps%2Fdesktop%2Fmodernize%2Fhost-custom-control-with-xaml-islands%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ein%20the%20documentation%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20follow%20all%20the%20steps.%3C%2FP%3E%0A%3CH4%20id%3D%22run-it%22%20id%3D%22toc-hId--1784444081%22%20id%3D%22toc-hId--1784444081%22%20id%3D%22toc-hId--1784444081%22%3ERun%20it!%3C%2FH4%3E%0A%3CP%3EThat's%20it!%20As%20usual%2C%20before%20testing%20our%20WPF%20app%2C%20we%20need%20to%20launch%20the%20React%20packager%20and%20the%20local%20web%20server.%20Once%20everything%20is%20up%20and%20running%2C%20you%20can%20right%20click%20on%20the%20Windows%20Application%20Packaging%20Project%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EDeploy%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eor%20press%20CTRL-F5.%20The%20WPF%20application%20will%20start%20and%2C%20if%20you%20have%20done%20everything%20properly%2C%20you%20will%20see%20your%20WPF%20application%20hosting%20your%20familiar%20React%20Native%20component%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20786px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137415i8052E4569FECC296%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22WpfToDos.png%22%20title%3D%22WpfToDos.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22wrapping-up%22%20id%3D%22toc-hId-154879759%22%20id%3D%22toc-hId-154879759%22%20id%3D%22toc-hId-154879759%22%3EWrapping%20up%3C%2FH3%3E%0A%3CP%3EIn%20this%20(long)%20blog%20post%20we%20have%20learned%20how%20React%20Native%20is%20a%20great%20solution%20not%20just%20to%20build%20mobile%20application%2C%20but%20also%20Windows%20experiences.%20If%20you're%20a%20C%23%20and%20XAML%20developer%20and%20you're%20interested%20in%20building%20cross-platform%20experiences%2C%20Xamarin%20and%20Xamarin%20Forms%20are%20still%20the%20best%20choice.%20However%2C%20in%20many%20cases%2C%20you%20may%20need%20to%20work%20with%20a%20development%20team%20with%20a%20strong%20web%20background%20and%2C%20in%20such%20a%20case%2C%20React%20Native%20is%20a%20great%20fit.%20As%20you%20have%20learned%20in%20this%20post%2C%20the%20React%20Native%20implementation%20for%20Windows%20is%20really%20flexible.%20Maybe%20you%20won't%20need%20to%20build%20a%20full%20UWP%20application%20from%20scratch%20with%20React%20Native%2C%20but%20the%20framework%20opens%20up%20many%20opportunities%20to%20reuse%20React%20Native%20components%20built%20by%20your%20web%20team%20inside%20your%20Windows%20applications.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EReact%20Native%20for%20Windows%20is%20still%20a%20work%20in%20progress%20and%2C%20as%20such%2C%20the%20deployment%20story%20isn't%20available%20yet.%20Right%20now%2C%20regardless%20of%20the%20way%20you%20compile%20your%20React%20Native%20for%20Windows%20project%2C%20you%20always%20need%20the%20Metro%20packager%20up%20%26amp%3B%20running%20in%20order%20to%20render%20the%20React%20content.%20Of%20course%2C%20this%20isn't%20the%20expected%20experience%20for%20the%20final%20user.%20Once%20the%20work%20on%20the%20deployment%20will%20be%20completed%2C%20you%20will%20be%20able%20to%20create%20a%20self-contained%20MSIX%20package%20(like%20for%20a%20regular%20UWP%20or%20Win32%20packaged%20application)%20and%20publish%20it%20on%20the%20Store%2C%20share%20it%20through%20a%20website%2C%20deploy%20with%20enterprise%20tools%20like%20SSCM%20or%20Intune%2C%20etc.%20You%20can%20see%20a%20glimpse%20of%20the%20expected%20experience%20by%20taking%20a%20look%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2Freact-native-windows%2Fblob%2Fmaster%2Fcurrent%2Fdocs%2FRunningOnDeviceWindows.md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eat%20the%20deployment%20story%20for%20the%20current%20React%20Native%20for%20Windows%20version%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20find%20all%20the%20samples%20mentioned%20in%20this%20article%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2Freact-native-windows-samples%2Ftree%2Fmaster%2Fsamples%2FTodosFeed%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eon%20GitHub%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHappy%20coding!%3C%2FP%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-926441%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20started%20with%20React%20Native%20for%20Windows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-926441%22%20slang%3D%22en-US%22%3E%3CP%3EWow%20finally%20React%20seems%20to%20be%20ultimate%20solution%20to%20building%20all%20platform%20variety%20of%20apps.%20Thanks%20for%20sharing.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

If you're familiar with web development, you'll know for sure React. This framework, built by Facebook, is becoming more and more popular to build client-side web experiences. Unlike other frameworks like Vue.js or Angular, React focuses only on the View component of a web application. It isn't a fully fledged framework like jQuery or Angular, which have an opinion on everything and, as such, they provide lot of features to perform all the kind of tasks, from HTML templates to APIs to handle HTTP requests. You need to rely on plain old JavaScript (or TypeScript, if you prefer) or on 3rd party libraries to achieve these goals.

 

What makes React peculiar (and not so easy to understand at the beginning if you're coming from traditional client-side development for Windows, like me) is the different development approach. You may be used to patterns like MVC or MVVM, which goal is to separate the UI from the business logic so that you can make your application easier to test, maintain and evolve. React, instead, being focused only on the View, is based on the concept of components, which are the different pieces that compose a page. Every component is independent from the other and it includes both the UI and the logic to handle the various events that it can trigger.

 

Since code is easier to understand than words, here is how a typical React component looks like:

 

class App extends React.Component {

  constructor(props) {
    super(props);
    this.showAlert = this.showAlert.bind(this);
  }

  componentDidMount() {
    window.alert("The component is ready!");
  }
  
  showAlert() {
    window.alert("Hello world!");
  }

  render() {
    return (
      <div className="App">
        <header className="App-header">
          <button onClick={this.showAlert}>Click me!</button>
        </header>
      </div>
      );
  }
}

As you can see, the component defines both the UI and the logic to handle the events associated with it:

  • The render() function is the one which declares the UI that this component will display.
  • The showAlert() function is triggered when the user clicks on the button declared in the UI.
  • The componentDidMount() function is part of the component's lifecycle and it's triggered when the component has been rendered and it's ready to work.

The UI might look like HTML, but it's actually defined using a special language called JSX, which is based on XML and it allows to declare your UI with JavaScript. It may sound blasphemous, but the goal is to go past the standard templating approach used by other frameworks, which is good when you just want to display some data, but it has its limitations when you want to do something more complex, like displaying or hiding something based on a specific condition. In the previous code you can see an example of this approach. In jQuery or another similar framework, you would need to use an API to get a reference to the button and then hook up the event. In React, instead, we can declare it just inline, by subscribing to the onClick event and by specifying the name of the function to invoke inside curly brackets.

 

<div> and <button> may look like plain HTML tags, but they're actually not. You can notice it, for example, by the usage of two attributes, className and onClick, which don't exist in standard HTML. React will take care of translating these JSX controls into the corresponding HTML ones and to handle the various state changes. To make thing simpler, the JSX controls in React resembles as much as possible the HTML ones, so the syntax will be very familiar to you.

 

Due to the growing popularity of React, Facebook has decided to extend the framework to support mobile development with the introduction of React Native. This was made possible by the fact that one of the core features offered by React is abstraction. React itself doesn't offer too many built-in features which are tight to a specific platform, but it leverages a render target to make sure that the View is rendered in the proper way. In the previous examples, React used a render target that can turn JSX into plain HTML. As such, React Native in nothing more than React with a different render target, which turns JSX into mobile controls.

 

React Native, from a mobile development experience point of view, can be seen as a mix between the classic Xamarin approach and the Xamarin Forms one. Like Xamarin Forms, it shares the opportunity of building truly native applications. React Native, in fact, doesn't use a WebView to render the HTML and JavaScript, like other web based technologies like Cordova. The various JSX controls are rendered using the corresponding native controls for Android or iOS, making the UI and the user experience coherent with the rest of the operating system. Xamarin Forms does the same, but by leveraging XAML as a markup language. However, like classic Xamarin, the goal of React Native isn't really to write an application once and run it everywhere, but rather allowing a team to build mobile applications using the same knowledge and sharing the same libraries. You will find out, in fact, that React Native includes many controls which are cross-platform (like Text or Image), but also many others which are specific for Android and iOS and that can't be used in a cross-platform way.

 

React Native includes a render target for iOS and Android but, since BUILD 2018, Microsoft has started to work on a render target for Windows. At BUILD 2019, however, Microsoft has announced a rewrite of the framework from C# to C++, with the goal to get better performances and to be better aligned with the core react-native implementation, which is built in C++ as well. The technology behind this framework is the Universal Windows Platform. React Native for Windows creates a new UWP project and the various JSX controls are rendered using native controls from the Universal Windows Platform and, in the future, from the WinUI library.

 

The framework is really flexible and it opens up many opportunities for Windows developers:

  1. You can build UWP applications from scratch using only React Native.
  2. You can integrate React Native components inside native UWP applications, allowing you to mix UWP controls with React Native controls.
  3. You can integrate React Native components inside WPF or Windows Forms applications, by leveraging XAML Islands, the technology which allows to render UWP controls inside Win32 applications.

In this blog post we're going to explore all these options. However, the purpose of this post isn't to be a comprehensive overview of React Native. I will give for granted that you're already familiar with this technology. If it's not your case and you want to learn more, you will find lot of tutorials and documentation on the official website. You can also start from the React website. The main concepts, in fact, are exactly the same between the two platforms, with the only difference that React outputs HTML, while React Native native controls.

 

Getting started

Let's start by setting up our computer with all the requirements needed to build React Native applications for Windows. The first one is Visual Studio 2019 with the following workloads installed:

  • Universal Windows Platform development (make sure to enable the C++ (v142) Universal Windows Platform tools option)
  • Desktop development with C++

Make sure also to check, in the Indivual components section, the following ones under Compilers, build tools and runtimes:

  • MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)
  • MSVC v141 - VS 2017 C++ ARM build tools (v14.16)

Now let's move to the "web tools". The first one is NodeJS, the JavaScript runtime built on top of the Chrome JavaScript engine. Everything around React Native (the core, libraries, etc.) is distributed as packages through the popular NPM package manager, so you'll need the NodeJS runtime to leverage it. You can get it from the official website.

 

Optionally (but highly suggested) is to install Yarn, a package manager for Node. As we're going to see in the next steps, it will help us a lot in setting up the whole environment. You can download it from the official website.

 

Last but not the least, if you want to debug your application you will need to leverage the Developer Tools included in Chromium. The official guidance on GitHub specifically invites you to install Chrome, but also the new Edge based on Chromium works like a charm.

 

That's it! Now we can start to create our first React Native project. You can refer to the guidance provided on the GitHub repository. I won't repeat them here since the steps might change in the future (for example, the targeted React Native version has changed multiple times since the project started).

The last tool I'm going to mention isn't exactly a requirement, but a strong suggestion. In order to build your React Native application you will need to use an IDE. Sure, you can use also Notepad, but there are better options out there, like Visual Studio Code, which offers also an extension for React Native which gives you IntelliSense, debugging, etc.

 

Make sure to have plenty of space on your hard disk. Since the React Native implementation for Windows is based on C++, the compilation artifacts will be quite big, so an average project's folder can easily reach the size of 5-6 GB.

Running your React Native for Windows project

The easiest way to launch your React Native for Windows project is to run the following command from your project's folder:

 

react-native run-windows

In the past there have been some issues that prevented this command to work properly. Most of them should be fixed now but, in case you're still hitting one of them, here is an alternative procedure:

  1. Open in File Explorer the windows folder inside the folder which contains your React Native project.

  2. Open the Visual Studio solution you'll find there. The name of the solution will match the name of the project.

  3. The solution is made by different projects, all based on C++. The main one (which contains the actual application to deploy) is the one which name matches with the React Native project's name. In our case, it's TodosFeed.

    ReactNativeSolution.png

  4. Compile the whole solution (again, it will take a while because of the C++ projects), then right click on the UWP project and choose Deploy. Make sure that, in the configuration dropdown, you choose an architecture which is suitable for your computer, like x86 or x64. The default value, in fact, will be ARM.

You should always launch the UWP project either from the Start menu or by pressing CTRL-F5 in Visual Studio, without attaching the debugger. The reason is that, in this scenario, the UWP app is just the "host" of the React Native application, so the real debugging must be done on the React code.

Before launching the application, however, you have to manually run the React packager by typing the following command in the project's folder:

 

yarn start

What is the React packager? It takes care of a few important tasks, like translating JSX into code that the target platform will understand and combining all your JavaScript into a single file. When you're in development mode, the command prompt with the React packager must always be up & running. This way, every time you make a change to the code of your React Native application, the packager will automatically create a new bundle and refresh the application.

 

Packager.png

 

Once the packager is ready, it should automatically launch Chrome on the local server which is used to serve the React application. If it doesn't happen, you can open it manually (or you can launch Edge based on Chromium) and open the URL http://localhost:8081/debugger-ui/. Then you can press F12 or CTRL-SHIFT-J to turn on the developer tools, which will help you to see any error that might arise in the React Native application. This operation is very important because, if the local development server isn't up & running, the UWP application won't be able to render the React Native content and you will get an error like the following one:

 

InstanceFailedToStart.png

 

Now that both the packager and the development server are up & running, you can launch the UWP application you have deployed. If you did everything well, you will see the packager starting to serve the various files in the command prompt and, in the UWP application, you will see the default React Native starter template.

 

ReactNativeTemplate.png

 

Using React Native to build a full UWP application

This is the simplest task, since with all the steps we have taken so far we have already created a full UWP application based on React Native. Let's try to create a more realistic one compared to the default template, which we're going to reuse for the next scenarios. As already mentioned, the UWP app is just the host of the React Native one, so to start actually coding you need to open the React Native project's folder with Visual Studio Code. Just right click on the folder and choose Open with Visual Studio Code or, alternatively, if you're still in the command prompt, type:

 

code .

As mentioned, the default page you see in the application is defined in the App.js file. Let's replace the default content with a simple application that displays a list of to-dos, downloaded from a REST service. This will be the final look & feel:

 

TodosApp.png

 

Nothing too complex, but enough to play with the React Native and Windows capabilities.

Let's start by building a component that will display the list of to-dos. Create a new folder in the project called components and, inside it, create a file called TodosList.js.

First, let's import the required controls:

 

import React, { Component } from 'react';
import {
  ActivityIndicator,
  View,
  FlatList,
  Text
} from 'react-native';

We're going to use four controls from React Native:

  • ActivityIndicator, to display a loading icon when the data is being downloaded from the REST service.
  • View, which is the basic container of React Native. Typically, it's the main entry point which contains, as child, the other controls. Think of it like the Page control in XAML.
  • FlatList to display the list of to-dos we have downloaded.
  • Text, to display a text.

Let's start to define our component:

 

import React, { Component } from 'react';
import {
  ActivityIndicator,
  View,
  FlatList
} from 'react-native';

class TodosList extends Component {

  render() {
    return(
      <View>
        <ActivityIndicator size="large" />
        <FlatList /> 
      </View>
    );
  }
}

export default TodosList

This is the basic skeleton, since the component doesn't actually include any data or any action. The component is defined using the standard React Native syntax based on ES6, the latest definition of the JavaScript language. We create a new class which extends the Component one, which is provided by the React library. The component defines a render() method, which include the JSX that represents the UI. The current View contains an ActivityIndicator and a FlatList which, however, we need to populate with some data.

Let's enhance our component with some new code:

 

import React, { Component } from 'react';
import {
  ActivityIndicator,
  View,
  FlatList
} from 'react-native';

class TodosList extends Component {
  constructor(props) {
    super(props);
    this.state = { todos: [], loading: false};
  }

  async componentDidMount() {
    this.setState( { loading: true});
    var result = await fetch("https://jsonplaceholder.typicode.com/todos");
    var json = await result.json();
    
    this.setState( { todos: json.slice(1,20), loading: false});
  }

  render() {
    return(
      <View>
        <ActivityIndicator size="large" animating={this.state.loading} />
        <FlatList data={this.state.todos}
                  renderItem={({item}) => <Text id={item.id}>{item.title}</Text>} /> 
      </View>
    );
  }
}

export default TodosList

First we need to introduce one of the most important concepts in React, state. It's a key - value pair collection where we can store data that must be displayed by the user interface. The nice bonus of the state management in React is that it automatically keeps the UI in sync. Whenever you're going to change one of the values stored in the state, every UI component connected to that value will be automatically updated. If you're a XAML developer, this concept should be familiar to you since it's similar to binding.

 

We define the state in the constructor of the component and we setup two properties: one called todos, which is an array that will store our collection of to-dos; the other one is called loading and it's a boolean we're going to use to hide / display the loading indicator.

Now that we have a place where to store our to-dos, we need to download them when the component is rendered. To achieve this goal we leverage the componentDidMount() method, which is one of the many available functions to handle the lifecycle of a component. Inside the function we use the JavaScript fetch API to download the list of to-dos from a REST service. We're using https://jsonplaceholder.typicode.com as endpoint, which is a service that returns fake data for testing and development purposes. The fetch API is asynchronous, so we use the async / await approach (supported by all the modern browsers nowadays) to handle it. In the end we convert the response into a JSON object by calling another asynchronous method, json(), and we store the result inside the todos object in the state. We also change the value of the loading property, so that we can hide the loading indicator.

 

You can notice two things:

  • To set the state, we are using the setState() method instead of setting it directly. This is required to enable the sync, otherwise the UI won't be notified that the value of one of the properties has changed.
  • We use the slice() method to take only the first 20 items from the result.

Now that we have some real data inside the state, we can populate the UI controls we have previously created:

  • We connect the animating property of the ActivityIndicator control to the loading property stored in the state (this.state.loading). This way, the loading indicator will be displayed when we start the operation and hidden when the data from the REST service has been downloaded.

  • We connect the data property of the FlatList control to the todos property stored in the state (this.state.todos). This way, the list will be automatically populated with all the items that have been downloaded from the REST service.

  • We use the renderItem property of the FlatList control to define how every single item of the list should be rendered. We express this property using a lambda expression, which gives us a reference to a single to-do in the list. For the moment we use a simple Text control and, inside it, we display the value of the text property of the to-do. We can understand where this property is coming from by opening the URL of the REST API in a browser or in a tool like Postman. We will see that each item inside the collection has the following properties:

    • userId
    • id
    • title
    • completed

As such, from the item object we can directly access to each of them.

 

Now that we have defined the TodosList component, we need to display it in replacement of the original React Native template. Move to the App.js file and, inside the class which defines the main component, change the render() method to:

 

class TodosFeed extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>To-dos</Text>
        <TodosList /> 
      </View>
    );
  }
}

That's it! Now make sure that the React packager is still up & running and that Edge / Chrome is open on the developer tools. The UWP application should update itself and you should see the list of to-dos being downloaded and rendered:

 

TodosFirstVersion.png

The controls we have defined using JSX have been translated into native UWP controls:

  • Text is now a TextBlock
  • ActivityIndicator is now a ProgressRing
  • FlatList is now a ListView

The nice benefit of the live debugger is that you won't have to redeploy the UWP application every time you make a change. Just change something in the React Native code in Visual Studio Code, hit save and the content of the UWP app will be reloaded to display the updates.

 

That's it! We have our first React Native application running in Windows as a full UWP application!

 

Embedding the React Native component inside a UWP app

Let's move to the next step and see another scenario. What if we want to use the React Native component we have just built not as part of a full React Native application, but inside an existing UWP application? You may have a UWP application already in development, but you may want to integrate a React Native component built by the mobile team for the Android and iOS versions of the same app.

 

Let's start! The first step is to move the React Native component we have built before from a full UWP app to a custom control, that can be reused in other UWP applications. Open the solution created by the React Native for Windows CLI (you'll find it inside the windows folder of your project). Then right click on it and choose Add → New project and select the Windows Runtime Component (Universal Windows) template:

 

WindowsRuntimeComponent.png

 

In this case I'm building a C# component since it's the language I'm most familiar with. However, you could use the C++ template as well since, other than setting up the React Native infrastructure, we aren't actually going to build something. All the content displayed in this control will be provided by the React Native implementation.

 

Feel free to delete the default class that is included in the project, then right click on it and choose Add → New item. Pick User control from the list and give it a meaningful name, like TodosFeedControl.xaml.

Now we need to include inside the newly created user control the React Native for Windows initialization. As first thing, right click on the project, choose Add → Reference and pick up from the list the project called ReactUWP.

 

Now that the React Native for Windows runtime is referenced, we need to add in the XAML file the control which will host the React Native application. First, let's declare the relevant namespace in user control definition:

 

xmlns:react="using:react.uwp"

Then, inside the main Grid, you need to add a ReactControl, which is part of the namespace you have just declared:

 

<Grid>
   <react:ReactControl x:Name="RootElement" />
</Grid>

Now let's move to the code-behind class of the user control. We need to add some code:

 

public sealed partial class TodosFeedControl : UserControl
{
    const string JSFILENAME = "index";
    const string JSCOMPONENTNAME = "TodosFeed";

    public TodosFeedControl()
    {
        this.InitializeComponent();
        LoadReact();
    }

    public void LoadReact()
    {
        InstanceSettings settings;

        settings.UseLiveReload = true;
        settings.UseWebDebugger = true;

        var instance = Instance.Create(JSFILENAME);
        instance.Start(settings);
        RootElement.Instance = instance;

        string initialProps = "{ "
                        + "\"one\":\"1\""
                        + ", \"two\":\"2\""
                        + "}";

        RootElement.InitialProps = initialProps;

        RootElement.JsComponentName = JSCOMPONENTNAME;
        RootElement.StartRender();
    }
}

This is boilerplate code to initialize React Native for Windows. The only relevant parts to highlight are the two constants declared at the top:

  • JSFILENAME defines the name of the JavaScript file which contains the starting point of the React Native app, without the .js extension. In our case, it's the index file.
  • JSCOMPONENTNAME defines the name of the component which acts as a starting point of the application. This string must match the name of the project; in our case it's TodosFeed.

That's it! Now we have a component that we can leverage in a full UWP application. Let's try this but, instead of using a basic UWP app, let's use a real one, to make things more interesting. We're going to use the XAML VanArsdel Inventory Sample, which is an open-source project developed by Microsoft to showcase the usage of the latest and greatest XAML controls in a real product.

 

InventoryApp.png

 

As first step, clone or download the project on your computer, then open the Inventory.sln solution. Now we need to add a reference to the user control we have just created. However, since the React Native for Windows implementation isn't stored in a library or in a NuGet package, we'll need to reference also the same C++ project that are referenced by the UWP application which hosts React Native.

 

To keep things cleaner, I decided to create a solution folder (right click on the solution and choose Add → New Solution Folder), where to store all the project related to React Native. Once you have created it, right click on it and choose Add → Existing project. You will need to reference the following 5 projects, which are all stored in the folder that contains the React Native project.

  • Folly, which is included in the node_modules\react-native-windows\Folly folder.
  • ReactUWP, which is included in the node_modules\react-native-windows\ReactUWP folder.
  • ReactCommon, which is included in the node_modules\react-native-windows\ReactCommon folder.
  • ReactWindowsCore, which is included in the node_modules\react-native-windows\ReactWindowsCore folder.

All the previous project files will have the extension .vcxproj, since they're based on C++. The last and fifth project to reference is the one we have just created to store our user control. In my case, it's called TodosFeed.Component and it's stored in the windows folder. This project's file extension will be, instead, .csproj, since it's based on C#.

 

This is how your solution should look like:

 

InventorySolution.png

Now we have everything we need! We can right click on the Inventory.App project, choose Add → Reference and select the TodosFeed.Component project. We're going to add our React Native component in the main dashboard of the application, along with the other widgets.

 

Dashboard.png

 

We can find the dashboard definition inside the Views → Dashboard → DashboardView.xaml file. Let's first add the namespace of our user control:

 

xmlns:react="using:TodosFeed.Component"

The page contains a GridView control with different panels declared as children. Let's add a new one at the end:

 

<react:TodosFeedControl Margin="12" Width="400" Height="250" />

This is how the full GridView definition should look like:

 

<GridView Grid.Row="2" 
          Margin="6" 
          ItemContainerStyle="{StaticResource GridItemStyle}"
          SelectionMode="None" 
          IsItemClickEnabled="True" ItemClick="OnItemClick">
    <GridView.ItemsPanel>
        <ItemsPanelTemplate>
            <controls:WrapPanel />
        </ItemsPanelTemplate>
    </GridView.ItemsPanel>
    <views:CustomersPane Margin="12" 
                             Width="600"
                             Height="250"
                             ItemsSource="{x:Bind ViewModel.Customers, Mode=OneWay}" 
                             Tag="Customers" />

    <views:ProductsPane Margin="12" 
                            Width="400"
                            Height="250"
                            ItemsSource="{x:Bind ViewModel.Products, Mode=OneWay}" 
                            Tag="Products" />

    <views:OrdersPane Margin="12" 
                          Width="400"
                          Height="250"
                          ItemsSource="{x:Bind ViewModel.Orders, Mode=OneWay}" 
                          Tag="Orders" />

    <react:TodosFeedControl Margin="12"
                            Width="400"
                            Height="250" />
</GridView>

That's it. The user control we have just added contains all the logic required to initialize the React Native component, so we don't need to do anything else other adding it to the XAML page.

Now it's time to build and deploy the application. Before doing it, however, we need to make sure that the React packager is up & running, otherwise the React Native component won't be rendered. As such, make sure that you have launched the yarn start command on the React Native project and that your browser is opened on the http://localhost:8081/debugger-ui/ URL.

 

If you have done everything correctly, after logging in on the dashboard you should see this:

 

DashboardWithReact.png

 

Voilà! Now our React Native component is being rendered inside the dashboard, along all the other native UWP controls.

 

Embedding the React Native component inside a Win32 app

Thanks to XAML Islands, we have the opportunity to embed inside a Win32 application a UWP control, either built-in in the platform or a custom one, like the one we have just created to reuse our React Native control. Let's move on and add our component to a WPF application built on top of .NET Core 3.0, since it's the platform that provides the best compatibility with XAML Islands.

 

Create a new solution in Visual Studio 2019 and choose WPF (.NET Core) as project's type:

 

WpfNetCore.png

 

As first step, you need to reference again all the projects required to run React Native and the user control we have created. These are the same ones we have added in the previous scenario: Folly, ReactCommon, ReactUWP, ReactWindowsCore and the custom control TodosFeed.Component.

 

Now we need to setup the whole infrastructure required to support XAML Islands in a WPF application. The official documentation contains a very detailed step-by-step guide, which is available here. As such, I won't repeat all the required steps in this post. The only thing to pay attention is that, compared to the documentation, we already have a project which contains a custom control in our scenario. As such, you can skip the step called Create a custom UWP control. You just need to make sure to add to the project's file the two properties which are required to make it working with a Win32 application.

 

Right click on the TodosFeed.Component project and choose Unload Project. Then right click on it again and choose Edit. Create a new PropertyGroup inside the <Project> element with the following entries:

 

<PropertyGroup>
  <EnableTypeInfoReflection>false</EnableTypeInfoReflection>
  <EnableXBindDiagnostics>false</EnableXBindDiagnostics>
</PropertyGroup>

Then reload the project again and you will be good to go. Just remember to add a reference to the TodosFeed.Component project both to the dummy UWP application and the WPF project.

 

Setup the WPF project

Microsoft provides an easy way to integrate XAML Islands in a WPF application by offering a control that does most of the heavy-lifting for you. The control is called WindowsXamlHost and it's included in the Windows Community Toolkit. To use it, you need to add the NuGet package called Microsoft.Toolkit.Wpf.UI.XamlHost in your WPF application.

The other step is to configure your solution to target a specific platform, since UWP controls can't target the generic Any CPU architecture. As such, right click on the solution in Visual Studio and choose Properties → Configuration Properties → Configuration Manager. Under Active solution platform, choose New, then add x64 or x86, as you prefer.

 

All the projects in the dialog should list, under the Platform column, the same architecture that is defined in the Active solution platform dropdown.

 

CpuArchitecture.png

 

Add the React Native component

Now that the project is setup in the right way, you can add to your WPF application the WindowsXamlHost control we have previously included with the NuGet package. We're going to add it to the MainPage.xaml file of the WPF application. First, you need to add to the Window element the following namespace:

 

xmlns:xaml="clr-namespace:Microsoft.Toolkit.Wpf.UI.XamlHost;assembly=Microsoft.Toolkit.Wpf.UI.XamlHost"

Then you can add the control inside the main Grid element:

 

<xaml:WindowsXamlHost InitialTypeName="TodosFeed.Component.TodosFeedControl" />

The InitialTypeName property is set with the full signature of the user control which hosts the React Native component.

Package the application as MSIX

The easiest way to make sure that everything works in the right way with XAML Islands is to package the WPF application as MSIX. However, compared to a traditional application, there are some extra steps to take, in order to make sure that all the files are included in the package in the right way. Make sure to read the section titled Package the app in the documentation and follow all the steps.

Run it!

That's it! As usual, before testing our WPF app, we need to launch the React packager and the local web server. Once everything is up and running, you can right click on the Windows Application Packaging Project and choose Deploy or press CTRL-F5. The WPF application will start and, if you have done everything properly, you will see your WPF application hosting your familiar React Native component:

 

WpfToDos.png

 

Wrapping up

In this (long) blog post we have learned how React Native is a great solution not just to build mobile application, but also Windows experiences. If you're a C# and XAML developer and you're interested in building cross-platform experiences, Xamarin and Xamarin Forms are still the best choice. However, in many cases, you may need to work with a development team with a strong web background and, in such a case, React Native is a great fit. As you have learned in this post, the React Native implementation for Windows is really flexible. Maybe you won't need to build a full UWP application from scratch with React Native, but the framework opens up many opportunities to reuse React Native components built by your web team inside your Windows applications.

 

React Native for Windows is still a work in progress and, as such, the deployment story isn't available yet. Right now, regardless of the way you compile your React Native for Windows project, you always need the Metro packager up & running in order to render the React content. Of course, this isn't the expected experience for the final user. Once the work on the deployment will be completed, you will be able to create a self-contained MSIX package (like for a regular UWP or Win32 packaged application) and publish it on the Store, share it through a website, deploy with enterprise tools like SSCM or Intune, etc. You can see a glimpse of the expected experience by taking a look at the deployment story for the current React Native for Windows version.

 

You can find all the samples mentioned in this article on GitHub.

 

Happy coding!

1 Comment
Occasional Visitor

Wow finally React seems to be ultimate solution to building all platform variety of apps. Thanks for sharing.