<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Andrei Calazans on Medium]]></title>
        <description><![CDATA[Stories by Andrei Calazans on Medium]]></description>
        <link>https://medium.com/@andreicalazans?source=rss-8cd05be4062c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Hg0a6HU9nzuy7jnmFZM3ug.jpeg</url>
            <title>Stories by Andrei Calazans on Medium</title>
            <link>https://medium.com/@andreicalazans?source=rss-8cd05be4062c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 16:56:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@andreicalazans/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Explicit Versus Implicit — The Cost Of Implicitness in Programming Comprehension]]></title>
            <link>https://andreicalazans.medium.com/explicit-versus-implicit-the-cost-of-implicitness-in-programming-comprehension-71f1441632c6?source=rss-8cd05be4062c------2</link>
            <guid isPermaLink="false">https://medium.com/p/71f1441632c6</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Sat, 06 Feb 2021 00:00:00 GMT</pubDate>
            <atom:updated>2021-02-08T12:07:47.242Z</atom:updated>
            <content:encoded><![CDATA[<h3>Explicit Versus Implicit — The Cost Of Implicitness in Programming Comprehension</h3><p>For better developer experience always prefer an explicit pattern.</p><p>There is an overhead with understanding implicit code. It implies that you know a contextual knowledge not written in front of you.</p><h3>JavaScript Throwable Functions</h3><p>In JavaScript, we have no way of signaling if a given function will throw or not. This is the implicitness of calling a function.</p><pre>// will it throw? Idk<br>someFunction();</pre><p>An alternative to make the error handling of a throwable function explicit is to request the user to pass an error callback.</p><pre>type SomeFunction = (onError: (err) =&gt; void, onSuccess: (res) =&gt; void) =&gt; void;</pre><p>Another alternative is to always return, and in this case you can return the result of a error value. See Maybe wrappers.</p><pre>type SomeFunction = () =&gt; Maybe&lt;Result&gt;;</pre><h3>React’s useEffect</h3><p>React’s useEffect is an example of the drawback to implicitness. Regardless to how powerful it is, it is hard to initially understand what it does by just looking at the code. On the contrary the class component lifecycles were very explicit to what it did: componentDidMount for example.</p><h3>Node JS Express’ Error Middleware</h3><p>The Node JS Express library allows you to handle errors by passing a callback to the app.use that has four arguments: err, req, res, and next.</p><p>While this function signature might seem obvious with a statically typed language if the type carries the name of its purpose, with plain JavaScript this is an implicit assumption that someone won’t understand by just looking at it.</p><p><strong>Express error handling</strong></p><blockquote><em>Define error-handling middleware functions in the same way as other middleware functions, except error-handling functions have four arguments instead of three: (err, req, res, next).</em></blockquote><p><em>expressjs.com, </em><a href="https://expressjs.com/en/guide/error-handling.html"><em>https://expressjs.com/en/guide/error-handling.html</em></a><em>, (Accessed Saturday, February 6, 2021)</em></p><p>Anonymous inlined functions are examples that carry implicitness overhead. The previous example of Express’s error handling function signature becomes even harder to understand when you see the app.use(...) with an inlined callback. It is not clear at all what the callback is doing without reading the function block.</p><h3>Further On Anonymous Functions</h3><p>The same occurs in other examples. In my experience, JavaScript’s Array.reduce is a common example of the implicitness overhead. If it takes a properly named function as a callback it becomes easier to grasp, else it requires more reading.</p><h3>58% Is Spent On Comprehension</h3><p>According to <a href="https://blog.feenk.com/developers-spend-most-of-their-time-figuri-7aj1ocjhe765vvlln8qqbuhto/">this article</a> we spend most of our time in a codebase trying to understand it. If you agree that explicit code is easier to understand than it should influence how we write code.</p><blockquote><em>This paper is quite interesting in that it describes in great details how the figures are obtained. And it says that Comprehension took on average ~58%</em></blockquote><p><em>blog.feenk.com, </em><a href="https://blog.feenk.com/developers-spend-most-of-their-time-figuri-7aj1ocjhe765vvlln8qqbuhto/,"><em>https://blog.feenk.com/developers-spend-most-of-their-time-figuri-7aj1ocjhe765vvlln8qqbuhto/,</em></a><em> (Accessed Monday, February 1, 2021)</em></p><h3>Plus</h3><p>Please do not confuse explicit versus implicit with declarative versus imperative.</p><p>Following a good naming convention and not writing implicit code will take you a long way to having an easier to comprehend codebase. See <a href="https://github.com/kettanaito/naming-cheatsheet">https://github.com/kettanaito/naming-cheatsheet</a> for naming convetion recommendations.</p><p>Despite the above highlighting how well named functions can help make a codebase more explict, using a purely functional programming library on your codebase to help can also add a lot of overhead to the codebase comprehension all because of the same reasons — implied knowledge.</p><p><em>Originally published at </em><a href="https://andrei-calazans.com/posts/2021-02-06/explicit-vs-implicit"><em>https://andrei-calazans.com</em></a><em> on February 6, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71f1441632c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to set up a Monorepo with React Native You.I and Yarn Workspaces]]></title>
            <link>https://medium.com/g2idev/how-to-set-up-a-monorepo-with-react-native-you-i-and-yarn-workspaces-3e83c3f08cf1?source=rss-8cd05be4062c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e83c3f08cf1</guid>
            <category><![CDATA[yarn-workspace]]></category>
            <category><![CDATA[monorepo]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 17:38:32 GMT</pubDate>
            <atom:updated>2020-02-06T17:38:32.033Z</atom:updated>
            <content:encoded><![CDATA[<p>In order to simplify dependency management, code reuse, and collaboration across teams, many projects have sought out to use the Monorepo structure. This post will outline how to achieve a Monorepo folder structure using React Native You.I alongside Yarn Workspaces.</p><p>Things this post covers:</p><ul><li><strong>How Yarn Workspaces work.</strong></li><li><strong>The errors Metro will throw.</strong></li><li><strong>Jest Testing.</strong></li><li><strong>A Possible Alternative.</strong></li></ul><h3><strong>Goal</strong></h3><p>Our goal is to have two apps in the same repository, and allow these two apps to use the same modules inside a directory named shared . We also want to be able to run tests separately for each app.</p><pre>- apps<br>   - app_one<br>   - app_two<br>- shared<br>   - module_one<br>   - module_two</pre><p>You can go ahead and try to do this yourself, we will generate the apps using youi-tv cli , however, if you are not using React Native You.I, you can use the react-native-cli instead.</p><p>To achieve this goal we will:</p><h3><strong>Create The Repository</strong></h3><p>In the location you want to create the project, run the following commands in your terminal line to create the folders, initialize git, initialize yarn, and generate the apps.</p><ul><li><strong>Create Folders</strong></li></ul><p>mkdir monorepo</p><p>cd monorepo &amp;&amp; git init</p><p>yarn init</p><p>mkdir apps</p><p>mkdir shared</p><ul><li><strong>Generate Apps</strong></li></ul><p>cd apps &amp;&amp; youi-tv init app_one</p><p>cd apps &amp;&amp; youi-tv init app_two</p><ul><li><strong>Create Shared Modules</strong></li></ul><p>cd shared &amp;&amp; mkdir module_one &amp;&amp; cd module_one &amp;&amp; yarn init</p><p>Paste the following in your terminal to create the index.jsfile:</p><pre><br>echo &quot;import React from ‘react’;<br>import { Text } from ‘react-native’;<br>import { FormFactor } from ‘<a href="http://twitter.com/youi/react-native-youi">@youi/react-native-youi</a>’;</pre><pre>export function moduleOne() {<br> return &lt;Text&gt;{FormFactor.isTV ? “Module one for TV” : “Module one for others”}&lt;/Text&gt;;<br>}<br>&quot; &gt;&gt; shared/module_one/index.js</pre><p>cd shared &amp;&amp; mkdir module_two &amp;&amp; cd module_two &amp;&amp; yarn init</p><p>Paste the following in your terminal to create the index.jsfile:</p><pre>echo &quot;</pre><pre>export function moduleTwo() {<br> return &quot;Module Two&quot;;<br>}<br>&quot; &gt;&gt; shared/module_two/index.js</pre><p>If you are following along, you should have the following structure by now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*VgJLQIeS0hT9TUTLfgGL7w.png" /><figcaption>Folder Hierarchy</figcaption></figure><h3><strong>Set Up Yarn Workspaces</strong></h3><p>According to the <a href="https://yarnpkg.com/lang/en/docs/workspaces/">documentation</a> we have to add the following configuration in our <strong>package.json</strong> file:</p><pre>“workspaces”: {<br>  “packages”: [<br>     “shared/*”,<br>     “apps/app_one”,<br>     “apps/app_two”<br>   ]<br> },</pre><p>This will allow our apps to access the shared packages.</p><h3><strong>Fixing Yarn Workspaces</strong></h3><p>Once you have added the configuration, you will have to delete all of your <strong>node_modules</strong> and install them again.</p><p>Run the following command in your terminal line to find all nested <strong>node_modules, </strong>delete them, and run yarn again:</p><pre>find . -type dir -name node_modules | xargs rm -rf &amp;&amp; yarn</pre><p>Now that this is done, technically we should be able to build and start our app.</p><p>If you remember the youi-tv cli output:</p><pre>Run `youi-tv docs` to see next steps.</pre><pre>Or run the following (on platform OSX for example):</pre><pre>cd app_two</pre><pre>youi-tv build -p osx</pre><pre>./youi/build/osx/Debug/app_two</pre><p>We should be able to do that and run the app. Let&#39;s try?</p><p>In app_one build an osx app by running: youi-tv build -p osx inside apps/app_one</p><p>Then, in that same directory, run yarn start</p><p>You will see the following error:</p><pre>~/youi/monorepo/apps/app_one   master  yarn start<br>yarn run v1.19.1<br>$ node node_modules/react-native/local-cli/cli.js start<br>internal/modules/cjs/loader.js:895<br> throw err;<br> ^</pre><pre>Error: Cannot find module ‘/Users/andrei/youi/monorepo/apps/app_one/node_modules/react-native/local-cli/cli.js’<br> at Function.Module._resolveFilename (internal/modules/cjs/loader.js:892:15)<br> at Function.Module._load (internal/modules/cjs/loader.js:785:27)<br> at Function.Module.runMain (internal/modules/cjs/loader.js:1143:12)<br> at internal/main/run_main_module.js:16:11 {<br> code: ‘MODULE_NOT_FOUND’,<br> requireStack: []<br>}<br>error Command failed with exit code 1.<br>info Visit <a href="https://yarnpkg.com/en/docs/cli/run">https://yarnpkg.com/en/docs/cli/run</a> for documentation about this command.</pre><p><strong>What is happening?</strong><br>If you look inside &lt;root&gt;/apps/app_one/package.json the start script tries to call cli.js with a relative path. And since we are using workspaces, all of our dependencies were lifted up to the root of the project, therefore, they are no longer inside &lt;root&gt;/apps/app_one/node_modules , they are instead in &lt;root&gt;/node_modules .</p><p>We can fix this by using the symlink of React Native provided by yarn</p><p>Replace both start and react-native scripts with the following:</p><pre>“start”: “react-native start”,<br>“react-native”: “react-native”,</pre><p><em>Note, the </em><strong><em>react-native</em></strong><em> script here is required because when we bundle the JavaScript code, our Cmake config runs </em><strong><em>yarn react-native bundle</em></strong><em> to achieve this. If you are using just </em><strong><em>React Native </em></strong><em>omit that script.</em></p><p><strong>Does yarn start work now?</strong></p><p>Yes, it should. You can run yarn start to test it. Now since you generated the osx app, you can run it directly from the terminal line with the following command inside the app_one directory:</p><p>./youi/build/osx/debug/app_one</p><p>You will notice it attaches to the Metro packager, however, it fails with a similar message to this:</p><pre>Loading dependency graph, done. Error: Unable to resolve module `./index.youi` from `/Users/andrei/youi/monorepo/.`: The module `./index.youi` could not be found from `/Users/andrei/youi/monorepo/.`. Indeed, none of these files exist:   * `/Users/andrei/youi/monorepo/index.youi(.native||.youi.js|.native.js|.js|.youi.json|.native.json|.json|.youi.ts|.native.ts|.ts|.youi.tsx|.native.tsx|.tsx)`   * `/Users/andrei/youi/monorepo/index.youi/index(.native||.youi.js|.native.js|.js|.youi.json|.native.json|.json|.youi.ts|.native.ts|.ts|.youi.tsx|.native.tsx|.tsx)`</pre><p>It can’t find your index.youi in /Users/andrei/youi/monorepo/</p><p>This expected since index.youi.js is in app_one</p><p>To solve this we have to extend Metro’s config to also add this new root which is the apps/app_one.</p><p>Replace rn-cli.config.js in app_one for the following metro.config.js</p><p><em>Note </em><strong><em>rn-cli </em></strong><em>was deprecated in favor of </em><strong><em>metro.config</em></strong></p><pre>const blacklist = require(&#39;metro-config/src/defaults/blacklist&#39;)<br>const path = require(&#39;path&#39;);</pre><pre>module.exports = {<br>    // Add additional folders to watch that are outside app&#39;s root<br>    watchFolders: [path.resolve(__dirname, &#39;../../node_modules&#39;), path.resolve(__dirname, &#39;../../shared&#39;)],<br>    // Black list build folders to not resolve any JavaScript files in there.<br>    resolver: {<br>        blacklistRE: blacklist([/\/youi\/build\/.*/])<br>    }<br>};</pre><p>By putting this metro.config.js in app_one Metro understands the new root of the project.</p><h3><strong>Problems with hoisting</strong></h3><p>Once you have overcome the issues with the root of the project. You can try running yarn start again and connect your app. You will run into the following problem:</p><pre>Loading dependency graph, done. error: bundling failed: Error: Unable to resolve module Composition from /Users/andrei/youi/monorepo/node_modules/@youi/react-native-youi/Libraries/react-native-youi/react-native-youi-implementation.js: Module Composition does not exist in the Haste module map</pre><p>or</p><pre>Unable to resolve module `AccessibilityInfo` from `/Users/andrei/youi/monorepo/node_modules/react-native/Libraries/react-native/react-native-implementation.js`: Module `AccessibilityInfo` does not exist in the Haste module map</pre><p>The following error is related to how the workspace lifts up your dependencies to the root of your project. We can disable this feature per module by changing the configuration of the workspace as follows:</p><pre>&quot;workspaces&quot;: {<br>    &quot;nohoist&quot;: [<br>      &quot;**react-native**&quot;<br>    ],<br>      &quot;packages&quot;: [<br>      &quot;shared/*&quot;,<br>      &quot;apps/app_one&quot;,<br>      &quot;apps/app_two&quot;<br>    ]<br>  },</pre><p><em>Note — Adding &quot;</em><strong><em>**react-native**&quot;</em></strong><em> includes both </em><strong><em>react-native</em></strong><em> and the </em><strong><em>react-native-youi</em></strong><em> folder to the no hoist rule.</em></p><h3>A Working App</h3><p>And now you should be able to run your app and see it connect correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TILgMv5H0puc2ujKATuyng.png" /><figcaption>App One Running in Monorepo Project</figcaption></figure><h3><strong>Jest Testing</strong></h3><p>The last piece of the puzzle is to make sure the tests work. Let&#39;s create the following test inside app_one</p><p>You can create a file in &lt;root&gt;/apps/app_one/app.test.js with the following test:</p><pre>import React from &#39;react&#39;;<br>import { View } from &#39;react-native&#39;;<br>import { FormFactor } from &#39;<a href="http://twitter.com/youi/react-native-youi">@youi/react-native-youi</a>&#39;;</pre><pre>describe(&#39;App&#39;, () =&gt; {<br>    it(&#39;should work&#39;, () =&gt; {<br>        expect(true).toBe(true);<br>    })<br>    <br>    it(&#39;should have react-native modules&#39;, () =&gt; {<br>        expect(View).toBeTruthy();<br>    })</pre><pre>it(&#39;should have <a href="http://twitter.com/youi/rect-native-youi">@youi/rect-native-youi</a> modules&#39;, () =&gt; {<br>        expect(FormFactor).toBeTruthy();<br>    })<br>})</pre><p>Then inside app_one folder you can run:</p><p>yarn test</p><p>Output:</p><pre>✘  ~/youi/monorepo/apps/app_one   master  yarn test </pre><pre>yarn run v1.19.1<br>$ jest [ ‘/Users/andrei/youi/monorepo/apps/app_one/node_modules/react-native/’, ‘/Users/andrei/youi/monorepo/apps/app_one/node_modules/@youi/react-native-youi/’ ] FAIL ./app.test.js ● Test suite failed to run /Users/andrei/youi/monorepo/apps/app_one/node_modules/@youi/react-native-youi/jest/setup.js:328 import { WebSocket } from ‘mock-socket’; ^^^^^^ SyntaxError: Cannot use import statement outside a module at ScriptTransformer._transformAndBuildScript (../../node_modules/@jest/transform/build/ScriptTransformer.js:537:17) at ScriptTransformer.transform (../../node_modules/@jest/transform/build/ScriptTransformer.js:579:25) Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 0.32s Ran all test suites. error Command failed with exit code 1. info Visit <a href="https://yarnpkg.com/en/docs/cli/run">https://yarnpkg.com/en/docs/cli/run</a> for documentation about this command.</pre><p>This occurs because react-native and @youi/react-native-youi ship uncompiled ES6 code. For <a href="https://jestjs.io/docs/en/configuration#transformignorepatterns-arraystring">Jest to compile</a> this code you must whitelist it in the transformIgnorePatterns option in your package.json as follows:</p><pre>“transformIgnorePatterns”: [ “/node_modules/(?!react-native|@youi)” ],</pre><p>After making this change, you can run yarn test again.</p><p>You should see the following problem:</p><pre>yarn workspace v1.19.1</pre><pre>yarn run v1.19.1</pre><pre>$ jest</pre><pre>[</pre><pre>&#39;/Users/andrei/youi/monorepo/apps/app_one/node_modules/react-native/&#39;,</pre><pre>&#39;/Users/andrei/youi/monorepo/apps/app_one/node_modules/@youi/react-native-youi/&#39;</pre><pre>]</pre><pre>FAIL  ./app.test.js</pre><pre>App</pre><pre>✕ should work (7ms)</pre><pre>● App › should work</pre><pre>Configuration error:</pre><pre>Could not locate module React mapped as:</pre><pre>/Users/andrei/youi/monorepo/apps/app_one/node_modules/react.</pre><pre>Please check your configuration for these entries:</pre><pre>{</pre><pre>&quot;moduleNameMapper&quot;: {</pre><pre>&quot;/^React$/&quot;: &quot;/Users/andrei/youi/monorepo/apps/app_one/node_modules/react&quot;</pre><pre>},</pre><pre>&quot;resolver&quot;: null</pre><pre>}</pre><pre>at createNoMappedModuleFoundError (../../node_modules/jest-resolve/build/index.js:501:17)</pre><pre>at Object.&lt;anonymous&gt; (node_modules/react-native/Libraries/Components/View/View.js:51:20)</pre><p>It is now complaining of a the moduleNameMapper configuration set by our @youi/react-native-youi preset.</p><p>There are two ways to fix this issue. One is overriding the preset configuration by making a custom preset and either pasting the preset in @youi/react-native-youi or spreading it over our JSON object. The second is also not hoisting the React package. We will choose the second option since that has been our way to go with the other modules as well.</p><p>Add React to the nohoist option:</p><pre>&quot;workspaces&quot;: {<br>    &quot;nohoist&quot;: [<br>      &quot;**react**&quot;,<br>      &quot;**react-native**&quot;<br>    ],<br>      &quot;packages&quot;: [<br>      &quot;shared/*&quot;,<br>      &quot;apps/app_one&quot;,<br>      &quot;apps/app_two&quot;<br>     ],<br> },</pre><p><strong>Result of </strong><strong>yarn test</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*ECc1WzX-UgU9eSeIFe3pgg.png" /><figcaption>yarn test</figcaption></figure><h3>Alternative</h3><p>As you can see the usage of Yarn Workspaces has proven to be quite burdensome to maintain. Overall, as your codebase progress and new updates occur, you might need to update and fix this Monorepo structure. To avoid having this kind of issue, and to also enjoy similar benefits. You could instead structure your Monorepo without symlinks created by yarn .</p><p><strong>How could we structure a </strong><strong>Monorepo without </strong><strong>Yarn Workspaces ?</strong></p><p>Under the same repository, you could have multiple independent projects linked by installing it via a relative path.</p><pre>- apps<br>   - app_one<br>   - app_two<br>- shared<br>   - module_one<br>   - module_two</pre><p>app_one and app_two can consume the shared module by installing it as follow:</p><p>yarn add file:../../shared/module_one</p><p>This will add the following to your package.json</p><pre>”module_one”: “file:../../shared/module_one”,</pre><p><em>Note, To avoid reinstalling the same dependencies make sure to declare modules as </em><em>peerDependencies inside your shared modules if you also use them.</em></p><p>This approach has the benefit of being compatible with NPM as well.</p><p><strong>Possible Problems</strong></p><p>If your shared modules have external dependencies and for some reason, you install them by running yarn inside shared/module , you have to always remember to remove the node_modules folder before running your app, else you will have name collisions.</p><h3><strong>Important Notes</strong></h3><ul><li>With Yarn Workspaces your shared packages will need to have react as a dependency.</li><li>With Yarn Workspaces your shared packages should not have react-native and @youi/react-native-youi as dependencies, this can cause collision conflicts.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e83c3f08cf1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/how-to-set-up-a-monorepo-with-react-native-you-i-and-yarn-workspaces-3e83c3f08cf1">How to set up a Monorepo with React Native You.I and Yarn Workspaces</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to interop between Objective-C and C++?]]></title>
            <link>https://andreicalazans.medium.com/how-to-interop-between-objective-c-and-c-cd0d7ff0e100?source=rss-8cd05be4062c------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd0d7ff0e100</guid>
            <category><![CDATA[cplusplus]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[cpp]]></category>
            <category><![CDATA[objective-c]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Wed, 22 Jan 2020 21:10:51 GMT</pubDate>
            <atom:updated>2020-01-22T21:10:51.014Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of cross-platform, it is common for the need to create bridges of communication between different languages. While working with React Native and iOS, I stumbled on a need to interop with a C++ class. This post covers how you can communicate between Objective-C and C++ code.</p><h3>Using Objective-C++</h3><p>You can transform your Objective-C file (.m) to Objective-C++ (.mm). This by default enables you to call any C++ code in your Objective-C++ file.</p><p><strong>MyObjective_c_file.mm</strong></p><pre><br><br>#include “SomePrivateCppClass.h”</pre><pre><a href="http://twitter.com/implementation">@implementation</a> MyObjective_c_file<br>- (instancetype) init<br>{<br> // Add your logic here<br> SomePrivateCppClass::someMethod();<br>}</pre><pre><a href="http://twitter.com/end">@end</a></pre><p><em>Note - Sometimes you can have issues with this approach especially when your C++ interface is importing code that causes an issue for the Objective-C compiler. To overcome this you can do the next step</em></p><h3>Interopping with a C interface to call an Objective-C function from C++</h3><p>When file separation is required due to external dependencies. You can interop by using a C interface.</p><p><strong>C.interface.h</strong></p><pre><br>void callFromCpp(const char *dataPayload);</pre><p><strong>MyObjective_c_file.mm</strong></p><pre><a href="http://twitter.com/implementation">@implementation</a> MyObjective_c_file<br>…<br> — (void)myMethod: (NSString *) dataPayload {</pre><pre>// Your logic here<br>}</pre><pre><a href="http://twitter.com/end">@end</a></pre><pre>void callFromCpp(const char *dataPayload) {<br> NSString *convertedString = [[NSString alloc] initWithCString: dataPayload encoding:NSUTF8StringEncoding];<br> <br> MyObjective_c_file myInstance = [[MyObjective_c_file alloc] init];<br> [MyObjective_c_file myMethod: convertedString];<br>}</pre><p><strong>YourCppClass.cpp</strong></p><pre><br><br>YourCppClass::WhatEverMethod() {<br> callFromCpp(stringData.c_str());<br>}</pre><h3>Passing pointers with a C interface to call a C++ method.</h3><p>When using a C interface, you can also pass a pointer of your C++ class in order to call it from your Objective-C++ code (This is ideal when you can’t include your C++ file due to dependencies).</p><p>In this case, you will instantiate your Objective-C class by calling a C function from your C++ method, then pass a pointer of your C++ class to your Objective-C interface for it to consume it.</p><p><strong>C.interface.h</strong></p><pre><br>void initFromCpp(long castBridgePointer);</pre><p><strong>MyObjective_c_file.mm</strong></p><pre><br>#include “YourCppClass.h”</pre><pre><a href="http://twitter.com/implementation">@implementation</a> MyObjective_c_file<br>static YourCppClass *pointerToBridge;<br>…<br>- (void)storeCastBridgePointer: (long) ptr {<br> pointerToBridge = (YourCppClass *) ptr;<br>}</pre><pre><a href="http://twitter.com/end">@end</a></pre><pre>void initFromCpp(long castBridgePointer)<br>{<br> MyObjective_c_file myInstance = [[MyObjective_c_file alloc] init];<br> [myInstance storeCastBridgePointer: castBridgePointer];<br>}<br></pre><p><strong>YourCppClass.cpp</strong></p><pre><br><br>YourCppClass::YourCppClass() {<br>  // whatever logic…</pre><pre>  initFromCpp((long) this);<br>}</pre><h3>Conclusion</h3><p>Interop between C++ and Objective-C is not too complicated. The purpose of this post is to bring both solutions, the plain Objective-C approach and C interface approach, into a single post where anyone can reference in the future</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd0d7ff0e100" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using You.i Engine One’s Designer Workflow to Reuse UI Components Across Mobile and TV Platforms]]></title>
            <link>https://medium.com/g2idev/using-you-i-engine-ones-designer-workflow-to-reuse-ui-components-across-mobile-and-tv-platforms-802e1272bdac?source=rss-8cd05be4062c------2</link>
            <guid isPermaLink="false">https://medium.com/p/802e1272bdac</guid>
            <category><![CDATA[cross-platform]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[youi]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Tue, 15 Oct 2019 18:52:52 GMT</pubDate>
            <atom:updated>2019-10-15T18:52:52.397Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve <a href="https://blog.g2i.co/one-react-native-video-interface-12-platforms-8af42931d294">talked before</a> about <a href="https://www.youi.tv/youi-engine/">You.i Engine One</a> saving hours of development time when building across platforms. Today, I want to talk about another use case of You.i Engine and that is leveraging component reusability on any form factor (mobile, tablet, or TV).</p><p>You.i Engine One’s Designer Workflow allows designers to create user interfaces in Adobe After Effects (AE) and then seamlessly pass off their concepts to developers. The UIs render directly to the platform through component references provided by Engine One. UIs can also be created using JSX thanks to You.i Engine’s React Native bridge.</p><p><strong>Note:</strong> the After Effects workflow has much more to it than this, and could be covered more broadly in another article (or by reading the <a href="https://developer.youi.tv/latest/Content/AE_referenceTopics/H1IntroToDesign.htm">documentation</a>). In this article, I will be focusing just on the re-use of components between form factors.</p><h3>The benefit of AE</h3><p>AE gives the designer the power to control how the UI looks in the app. The group of layers and nodes that come together to compose the UI is called a Composition.</p><p>You.i Engine allows for the designer to specify under a folder in After Effects for all the designs related to the targeted platform. For instance, all designs related to handsets are under a single folder, same for TV and tablets. There is also an option for defaults which can be reused across platforms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*uZmK05NoIA4UqjlPbgq3Bg.png" /><figcaption>Snapshot from After Effects Project structure</figcaption></figure><p>You.i Engine is configured to bundle the right assets with your project and build according to the platform. The asset locator is responsible for this. It also allows you to configure it to switch on any arbitrary factor, such as DPI, accessibility, dark mode, branding, etc.</p><p>The AE approach to design empowers the designer to be able to make changes to how the app looks without changing any code. Once the code that references a design is written, the design can change as much as it wants, as long as it does not break the contract by modifying the name and layer structure of AE.</p><p>For example, take the following trial button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XpVNFhUWuVnrT8fW14GMew.png" /></figure><p>Its tree hierarchy in the design is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*znxLVsL8_H5bzVBEDbpTJg.png" /><figcaption>Trial Button Tree Hierarchy</figcaption></figure><p>Once this design is in place and exported, it can be referenced in code and rendered to the screen.</p><p>The reference in code looks like the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bfa61a73799f82d365a8bc041dce74c6/href">https://medium.com/media/bfa61a73799f82d365a8bc041dce74c6/href</a></iframe><p>The ViewRef in this example is optional, it will not fail if you only write the ButtonRef under Composition. Following this pattern resolves ambiguity when you have multiple sibling layers with the same name. This is a common pattern with animations, for instance.</p><p>Once this reference is in place, the design team can make any changes to the design. As long as the tree structure and names of each layer are not changed, no updates are required in code.</p><h3>Reuse UI References Across Platforms</h3><p>Let’s see how we can leverage code reuse of UI references.</p><p>Despite all the visual possibilities for each platform, there is a pattern in UI compositions. Let’s imagine a sign-in screen. There are multiple ways to design this. Nevertheless, you can expect every sign-in screen to have two inputs, a forgot password button, and a sign-in button. Visually for each platform they can be very different, but structurally they can be the same.</p><p>The AE structure for a log-in screen can be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sgi652yYly_sIWzM6cXfEQ.png" /><figcaption>Login Design Tree</figcaption></figure><p>You.i After Effects plugin allows you to compose your UI out of different layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*rG0U3rddBzLNRfe1wEwMAQ.png" /><figcaption>You.i Component Categories</figcaption></figure><p>In our login design tree, Main is a Container layer, which has two Container layers as children (InputsContainer and ButtonsContainer) and a Text layer (Title). We can replicate this same tree structure for TV, handset, and tablets. However, despite following the exact same tree structure, you can layout it out as you want. Here is how this design structure could be applied to the UI on different form factors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*0hUn0xDT1-5BuLmPMs-Zdw.png" /><figcaption>Handset Log In Screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oxPwEFA0FRIS-zCXYcNvVw.png" /><figcaption>Tablet Portrait Log In Screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qDc8PCEwuSBsDCkS0TRo2Q.png" /><figcaption>TV Log In Screen</figcaption></figure><p>These skeleton UIs would serve as a starting point for the designers. The advantage is we need only one JSX component referencing these layers for all three platforms. And as long as the contract is never broken no code would need to be changed. This reduces a lot of code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfefbff12e97fd16b38699b72cad0d46/href">https://medium.com/media/dfefbff12e97fd16b38699b72cad0d46/href</a></iframe><h3>What About A Movie Lander</h3><p>Movie landers are usually composed of a hero image with a title and a large list of provided movies to watch. We could structure it as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*7kJsXmHcw3Y5ovF8UwNv5g.png" /><figcaption>Movie Lander Design Tree</figcaption></figure><p>Hero and MovieThumbnail are just container layers composed of different nodes as children.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*qa3XtJmtyG2oAEeC8TzGRg.png" /><figcaption>Hero Container Layer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*_OpH87dcTc4yk_-v6jAm5A.png" /><figcaption>MovieThumbnail layer</figcaption></figure><p>Once we have designed this for each platform we are targeting and structure it equally, we can write a single JSX component to reference it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/356ffaee318c526e18f0fdbfe69b252e/href">https://medium.com/media/356ffaee318c526e18f0fdbfe69b252e/href</a></iframe><p>This design structure can render completely different layouts according to the platform. These differences can be made within After Effects by a production designer. Take the following as an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*P9xYN0dQibdtcU321H7FkQ.png" /><figcaption>Movies Lander on Handset</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c60-wr6-WV1_ExXJ1eLdxg.png" /><figcaption>Movies Lander on a Tablet</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-7GM6fTWagg8vffEC1kqLQ.png" /><figcaption>Movies Lander on TV</figcaption></figure><h3>Conclusion</h3><p>The main idea behind this approach is to structure your UI tree with the same names and layers. This way you can reuse the same component references. An important part of this architecture decision is to properly separate domain logic from UI. If you couple this logic it will be hard to maintain and scale your codebase. I recommend you watch <a href="https://www.youtube.com/watch?v=WpkDN78P884&amp;t=793s">Uncle Bob’s Architecture the Lost Years talk</a> and read <a href="https://blog.g2i.co/react-separation-of-concerns-78ec0545bf36">this other post I wrote</a> about the separation of concerns in React apps if you want to study this subject further.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=802e1272bdac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/using-you-i-engine-ones-designer-workflow-to-reuse-ui-components-across-mobile-and-tv-platforms-802e1272bdac">Using You.i Engine One’s Designer Workflow to Reuse UI Components Across Mobile and TV Platforms</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bridging the emotional barrier of a code rewrite.]]></title>
            <link>https://andreicalazans.medium.com/bridging-the-emotional-barrier-of-a-code-rewrite-36312383867d?source=rss-8cd05be4062c------2</link>
            <guid isPermaLink="false">https://medium.com/p/36312383867d</guid>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Fri, 23 Aug 2019 18:54:42 GMT</pubDate>
            <atom:updated>2019-08-23T18:54:42.880Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Bridge with fog Photo by Yuliya Ginzburg on Unsplash" src="https://cdn-images-1.medium.com/max/1024/1*JWp_YmpPybEga58BqpVe0w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@yullik?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Yuliya Ginzburg</a> on <a href="https://unsplash.com/search/photos/bridge-emotions?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>As a developer, we are like artists, we take pride in the code we write. Have you ever spent a significant number of hours, working on a feature, taking careful steps to test it and validate its functionality? If yes, then someone might have also told you to change it, if not completely at least partially. Well, I have been in that situation. Despite a few years of experience, the stress and emotional barrier generated by this change is always enormous.</p><p>How to deal with this? It is unquestionable how hard it is to deal with this emotion, the feeling of being disappointed, unmotivated, discordant. We can not deny the fact that we are emotional beings easily tampered with. The first step is to admit your emotions. Think about them, try to identify why you are feeling in such a way. The second step is to vent it out, try to put your feelings in words, tell the story of how you arrived at that feeling. It is often common while venting, for the person to realize what is behind his/her emotional state because he/she is hearing him- herself.</p><h3>The Someone</h3><p>Finding the ideal someone to talk to can be hard. It’s a good idea to have a friend, who you can be open about anything, who is not biased or intoxicated by the same feelings as you. You might want to avoid your coworkers for that reason since they share the same context, they might feel the same pain. It won’t help if the person you are venting to is motivating your negative feelings.</p><p>Do not ignore your feelings. When a feeling was triggered by an underlying trauma, which we often have no clue about. It will easily go away after venting. When we try to evaluate something rationally and it does not make any sense our brain discards it. However, do not ignore this, if this feeling keeps coming back on similar triggers you should seek for help with professional therapists.</p><p>Self-awareness is a great tool to deal with our emotions. Love yourself, take care of yourself. Thank you for reading this, I wrote this article after facing an emotional issue triggered by a code rewrite. It shocked me how intense I felt. After dealing with my emotional state rationally. I tried to think of all of the things which caused me to feel the way I felt. I found out a few interesting things about myself in this process which I believe made me grow emotionally. Hopefully, this text will inspire you to be aware of your emotions and take care of yourself.</p><blockquote>Saying no is hard because we are a species that (sadly) treats agreement as affection and denial as rejection. When people disagree with us or turn us down, we routinely (and typically incorrectly) interpret it as evidence of enmity.</blockquote><p><a href="https://hbr.org/2019/08/how-to-say-no-at-work-without-making-enemies">https://hbr.org/2019/08/how-to-say-no-at-work-without-making-enemies</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36312383867d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React — Separation of Concerns]]></title>
            <link>https://medium.com/g2idev/react-separation-of-concerns-78ec0545bf36?source=rss-8cd05be4062c------2</link>
            <guid isPermaLink="false">https://medium.com/p/78ec0545bf36</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[mobx]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Tue, 06 Aug 2019 18:24:46 GMT</pubDate>
            <atom:updated>2019-08-07T12:23:27.598Z</atom:updated>
            <content:encoded><![CDATA[<h3>React — Separation of Concerns</h3><blockquote>When specifying the behavior of a data structure component, there are often two concerns that need to be dealt with: basic functionality and support for data integrity. A data structure component is often easier to use if these two concerns are divided as much as possible into separate sets of client functions.²</blockquote><h3>Data Colocation</h3><p>Data colocation has been part of React since the beginning. From the early days until now, Component State has always been a way to colocate data with components. GraphQL Clients also pushed on this idea, Relay, for example, has a Fragment Container plus data masking approach, each component can declare its data requirements and only receive what it required. Data masking will hide data required from other child fragments.</p><p>Despite these tendencies, Redux and Mobx moved towards a separate idea. Domain logic separation from components. Make the components as dumb as possible which essentially meant not having any Domain fetching logic in it.</p><p>One can comment that GraphQL Client like Relay, also achieves separation of concerns. It abstracted the network requests and you essentially only declare your data needs through a selector, in Relay&#39;s case a GraphQL Query. Also, its mutation commit API is not tied to injected props. Apollo has less separation, mutations are expected to be done inside the Components and their FaCC¹ approach also enforces this.</p><h3><strong>Client Software</strong></h3><p>There are two relevant parts to every Client Software. A User Interface and the Domain Logic. The former is everything you interact with, the modal, screen, and tooltip. The latter represents everything related to your business. The data you are fetching and normalizing about the User or Friends are part of your domain logic. The validation of user input is a domain logic, however, the state you hold that decides that the input should be red because it is wrong is a UI logic.</p><p>Separation of concerns is an important principle of Software Engineering. There are enough posts which argument this point. See <a href="https://softwareengineering.stackexchange.com/a/32614">this StackExchange answer</a> which gives a practical example of the benefits.</p><h3>Separating Concerns</h3><p>If the goal is to separate than let&#39;s review the available approaches. Imagine we represent each layer with the following color:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*KP-vlEDv8cyhr__DlACGlw.png" /></figure><p>By using just React. You are essentially holding State at the same layer you are rendering. A very common approach is to fetch user information on the first render and store this data locally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*UewrzB44_Fj9NQoJMWRwLA.png" /></figure><p>The above approach mixes Domain logic with UI Logic. Any changes to Domain logic would require direct changes to the UI logic, exposing the UI to possible regression bugs. There is however a way to avoid this. Which would be by Containerizing the domain logic, thus, wrapping your UI components with stateful Components. Giving us then the following representation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*F3_cNBMchus-cgyA5n9svg.png" /></figure><p>Container versus Presentational approach has been largely discussed by the community. However, there seems to be a misunderstanding of the current changes made by React. By adding hooks, the community interpreted that React Applications should now keep Domain logic inside the components, next to the UI logic. This misunderstanding can be evidenced by this tweet:</p><h3>Islam Attrash on Twitter</h3><p>Something confuse me with #React #Hooks. I hope that I find someone that elaborate on this</p><p>David K. also mentions his observation of how React currently encourages Domain logic coupling with UI logic.</p><h3>David K. 🎹 on Twitter</h3><p>💡 Model and develop your app&#39;s logic as if it will be used in many different UIs (e.g., web, CLI, native, etc.), even if it won&#39;t be. This will force you to avoid coupling logic with presentation, which mainstream frameworks (React, Angular, Vue) unintentionally encourage.</p><p>The addition of hooks did not prohibit the Container approach. Matter of fact, Hooks did not add any new functionality to React. It only changed the API Surface.</p><h3>Leaking Logic</h3><blockquote>The problem is not the approach. But rather the lack of understanding where the line crosses.</blockquote><p>The problem is not the approach. But rather the lack of understanding where the line crosses. Most approaches either directly leak Domain logic into the UI or allow you to do so. Composing the following structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*oA89dCB4wIjsJmNMGivleQ.png" /></figure><p>Here we have Domain Logic leaked inside the UI and also inverse direction — UI logic leaked into the Domain. What are examples of leaked logic?</p><p><strong>By Injecting Props</strong></p><p>Imagine the following: One can have some data about the result of a quiz. The goal is to render the right and wrong questions. By checking the right and wrong questions inside the UI rendering logic you are leaking your Domain logic. Your UI should only worry about rendering, not validating the data.</p><p>Although Redux provides ways to avoid the direct use of dispatch inside your component. Directly calling dispatch inside your UI layer, you are essentially leaking your Domain logic. Instead of calling <em>dispatch(getUser(payload))</em>, the UI should only worry about a <em>getUser </em>function. Better yet would be if your UI only worried about User data.</p><p>GraphQL Clients like Apollo and Relay both leak Domain logic into the UI layer. Relay, injects a relay prop which allows you to directly call relay functions. Apollo, injects a client prop with similar features. There are alternatives to avoid this leak, nonetheless, the existence of it makes most implementation naturally leak the logic.</p><p><strong>By Lifting State</strong></p><p>The inverse leak — lifting up logic to a domain container from the UI layer. The separation of concerns can confuse Developers. Separating Domain logic form UI does not mean UI does not have any state. State related to a View should be inside the View.</p><h3>More</h3><p>When following Software Development principles, many overlap with the separation of concerns. The goal is to achieve a scalable and maintainable codebase. The fact is we want to change code, add features, and feel confident of the work we have done. Needless to say that software is the result of a very flexible composition of written syntax. It allows you to write it any way you like. Therefore, there won&#39;t be a right or wrong case. But rather a suggestive path you can take.</p><p>If you want to dig more into this topic, I suggest you read <a href="https://michel.codes/blogs/ui-as-an-afterthought">Michel Westrate UI as an afterthought post</a>. Also, follow <a href="https://twitter.com/DavidKPiano">David K.</a> who occasionally tweets about State Machines.</p><p><strong>Footnotes</strong></p><p>[1] FaCC — Function as Child Component. Commonly called Render Props.</p><p>[2] Principles of Software Engineering. In University of Minnesota Duluth site. Retrieved August 3, 2019, from <a href="https://www.d.umn.edu/~gshute/softeng/principles.html">https://www.d.umn.edu/~gshute/softeng/principles.html</a></p><p>[3] UI as an afterthought. In Michel Codes. Retrieved August 3, 2019, from <a href="https://michel.codes/blogs/ui-as-an-afterthought">https://michel.codes/blogs/ui-as-an-afterthought</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78ec0545bf36" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/react-separation-of-concerns-78ec0545bf36">React — Separation of Concerns</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One React Native Video Interface. 12 Platforms.]]></title>
            <link>https://medium.com/g2idev/one-react-native-video-interface-12-platforms-8af42931d294?source=rss-8cd05be4062c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8af42931d294</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[g2i]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[you-tv]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Thu, 04 Apr 2019 00:20:13 GMT</pubDate>
            <atom:updated>2019-04-04T11:03:57.344Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ToEhJ-LLLL011Pnn.jpg" /><figcaption>Taken from <a href="https://media.wochit.com/wp-content/uploads/0405-Covers.jpg">google</a> 0_0</figcaption></figure><p><em>Originally posted on </em><a href="https://www.youi.tv/react-native-video-interface-12-platforms/"><em>https://www.youi.tv/react-native-video-interface-12-platforms/</em></a></p><p>When You.i TV approached G2i to help build a streaming video app using their You.i Engine One SDK, I was a bit worried. One, we as a company had never built a streaming app before so I knew we’d run into unique challenges. Two, the list of target platforms was broad; handsets, tablets, and TV devices. Three, React Native was to be the main framework.</p><p>I have been part of several React Native projects targeting handsets and tablets, but I’ve never had to deal with TV-connected devices. This, along with the streaming aspect, caused a bit of concern.</p><p>What about the cross-platform video solution?</p><p>Based on my previous experience, I knew that in order for G2i to deliver a high-quality cross-platform video player in React Native, we would need to bridge a video component to its native counterpart on each platform we were targeting.</p><p>To target TV platforms, the following native video interfaces needed to be maintained:</p><ul><li><a href="https://developer.apple.com/documentation/avfoundation/avplayer">AVPlayer</a> for iOS and Apple TV, interface in Objective-C or Swift</li><li><a href="https://developer.android.com/guide/topics/media/exoplayer">ExoPlayer</a> for Android and Fire TV, interface in Java or Kotlin</li><li><a href="https://sdkdocs.roku.com/display/sdkdoc/Video">Roku Video Player</a>, interface in Brightscript and SceneGraph</li><li><a href="https://developer.samsung.com/tv/develop/api-references/samsung-product-api-references/avplay-api">AVPlay for Tizen</a>, interface in JavaScript</li></ul><p>I found an open sourced project called <a href="https://github.com/react-native-community/react-native-video">react-native-video</a> which is an attempt to bridge a video solution for React Native. It’s quite powerful but it doesn’t offer support for Roku and Tizen. It also wouldn’t help reduce the size of the effort needed to invest to get these apps out the door. React-native-video has over 10,000 lines of code and documentation across four languages (3.2k Java, 1.6k JS, 1.6k Obj-C, 1.1k C#, 1k documentation), as well as 482 opens issues, 621 closed.</p><p>It’s not easy bridging a video interface.</p><h3><strong>You.i Engine One SDK</strong></h3><p>At first, I thought You.i Engine One was just a rendering solution which allowed developers to reference After Affects drawings as components. I was not aware of the deeper features it possessed.</p><p>Besides helping me connect my components with elements created by designers, it also provides a set of tools to get the work done. One of these tools is a video interface in React Native. Turns out, rendering a video component to 12 different platforms wasn’t a cause for concern after all. All I have to do is write the following component in React Native.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d15b699259a329c96990820f27e9aef/href">https://medium.com/media/2d15b699259a329c96990820f27e9aef/href</a></iframe><p>The above renders to:</p><ul><li>Roku</li><li>Fire TV</li><li>iOS &amp; tvOS</li><li>Android &amp; Android TV</li><li>PlayStation 4</li><li>Xbox One</li><li>Samsung Tizen</li><li>Desktop Platforms: Windows, MacOS, and Linux</li></ul><p>The video component is part of You.i Engine One, no bridge is necessary to access it.</p><p>I was amazed at how easy this was. Thanks to this component, we are able to focus on building the software. No time was wasted bridging and preparing underlying components for use.</p><h3><strong>Making use of the Video interface</strong></h3><p>Still not convinced? Here’s a complete example.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b52f2c2426f0c59c48a5f4233d2db848/href">https://medium.com/media/b52f2c2426f0c59c48a5f4233d2db848/href</a></iframe><p>By simply using the Video component, we have a video interface which renders to the screen as follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iOfFKi9f6JWDio_I.gif" /><figcaption><em>Video playback on handset (landscape)</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GwV6wZakd-ESC7P7.gif" /><figcaption><em>Video playback on tablet</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*St1paS_LcjIrl-T6f8F5lA.gif" /><figcaption><em>Video playback on OSX</em></figcaption></figure><p><strong>Congratulations, you got 100+ hours of development work done in less than 30 minutes by using the video component provided by Engine One.</strong></p><p>The code displayed in the example above is available in this <a href="https://github.com/AndreiCalazans/YouiTestApp">repository</a>.</p><h3><strong>Our journey with You.i Engine One</strong></h3><p>You.i Engine One is an amazing product to work with. The product team at You.i TV is always available to help us out and give us the support we need. We are currently building an amazing application on behalf of the You.i TV team and we are eager to share our experiences once this app hits production. Feel free to read along <a href="https://blog.g2i.co/">G2i’s blog</a> to learn more about what we’re up to.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8af42931d294" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/one-react-native-video-interface-12-platforms-8af42931d294">One React Native Video Interface. 12 Platforms.</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resumo da React Conf Brasil — 2018]]></title>
            <link>https://medium.com/reactbrasil/resumo-da-react-conf-brasil-2018-578ec5852bd1?source=rss-8cd05be4062c------2</link>
            <guid isPermaLink="false">https://medium.com/p/578ec5852bd1</guid>
            <category><![CDATA[brazil]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactconf]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Mon, 29 Oct 2018 23:19:03 GMT</pubDate>
            <atom:updated>2018-10-30T12:21:53.581Z</atom:updated>
            <content:encoded><![CDATA[<h3>Resumo da React Conf Brasil — 2018</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3KME7XmtZkdLzWWHbcR4cA.png" /><figcaption>React Conf Brazil</figcaption></figure><p>A maior conferência de React da América Latina reuniu, em seu segundo ano, grandes referências do cenário brasileiro em React. Resumi aqui tudo o que aconteceu.</p><p>A React Conf Brasil obteve um número impressionante este ano, foram 600 ingressos vendidos e lista de espera para desistências. O evento ocorreu no dia 20 de outubro no Teatro Brigadeiro na Capital Paulista. Houveram várias empresas participando e patrocinando. Foi um local com muito <em>networking</em> e desenvolvedores de todo o Brasil.</p><p><strong>Escrevendo seu próprio React Render</strong><br><a href="https://medium.com/u/9fee3779af5e">Raphael Amorim</a><br><a href="http://twitter.com/GoDaddyRio">@GoDadd</a>y<br>Rio de Janeiro, RJ</p><p>Raphael deu um <em>deep dive</em> no processo de renderização de um componente via React. Explicou o <strong>React.createElement</strong> e como o Reconciler é utilizado pelo <strong>Virtual DOM</strong>. Seu foco foi em como customizar o <strong>Renderer</strong> para isso ele criou um React Renderer<em>,</em> para renderizar uma música como ArrayBuffers. No final, Raphael anunciou seu plano de lançar o <a href="https://github.com/raphamorim/react-ape">react-ape</a>, um renderizador para criar interfaces usando Canvas/WebGL.</p><p><strong>O poder do SSR</strong><br><a href="https://medium.com/u/56a528c3eb78">Fernando Daciuk</a><br><a href="https://queroser.ninja/">@queroser.ninja</a><br>Curitiba, PR</p><p>Fernando Daciuk, professor e desenvolvedor, desconstruiu Server Side Rendering. Primeiro ele distinguiu Client Side Rendering de Server Side Rendering, depois aprofundou em SSR. Explicou quando precisamos de SSR, interessante saber que hoje para o indexador do Google não é necessário SSR já que é capaz de indexar código renderizado no cliente. Mostrou alguns <em>pitfalls</em> que encontramos, como o ambiente não ser o mesmo, portanto não temos acesso ao <strong>window </strong><em>keyword</em> e referências ao navegador.<strong> </strong>Após a sua explicação do básico sobre SSR Daciuk mencionou soluções que existem como NextJS, AfterJS e Gatsby.</p><p><a href="https://docs.google.com/presentation/d/1lY5u-TeYDVdg4rfd5uWub2EYC8QHNqbvnbtYOIQg_qs/present?slide=id.g440728cc19_0_619">Slides</a></p><p><strong>TypeScript vs Flow no segundo semestre de 2018<br></strong><a href="https://medium.com/u/5104cc745d52">Larissa Thaís de Farias</a><br><a href="http://www.vanhack.com/">@VanHack</a><br>Joinville, SC</p><p>Larissa aprofundou sobre tipagem estática em JavaScript. Contou sua experiência trabalhando antes na Rung e agora na Vanhack e como teve que, através da prática, pesquisa, e conversas com referências do cenário do React Brasil, tomar a decisão entre Flow ou TypeScript. Resumindo mencionou a superioridade do TypeScript apesar das facilidades do <em>onboarding</em> para iniciantes com Flow. Mais informações podem ser encontradas <a href="https://medium.com/rung-brasil/typescript-vs-flow-no-segundo-semestre-de-2018-54af2d4325d1">no post</a> que ela fez sobre o assunto.</p><p><a href="https://slides.com/larissathaisdefarias/typescript-vs-flow/">Slides</a></p><p><strong>Uma experiência open-source com React Native, GraphQL e Relay Modern</strong><br><a href="https://medium.com/u/1767240d4175">Luiz Fernando</a><br><a href="https://www.popstand.com/">@Popstand </a><br>São Paulo, SP</p><p>Luiz foi encarregado de fazer um App usando React Native para a conferência. Nesta <em>talk</em> ele apresentou os desafios encontrados e as decisões que tomou. O App consistia basicamente de um React Native App consumindo dados com GraphQL. Levantou um ponto na decisão de migrar para Apollo após usar Relay.</p><p><a href="https://docs.google.com/presentation/d/1yBmaSl9aN8i6a5EpNGg7W9FiTgRBFScMx1KmxXaJZ8I/edit">Slides</a></p><p><strong>A Jornada do React Native na Globo.com<br></strong><a href="https://medium.com/u/dc774f79bd63">Raphael Porto</a><br><a href="http://globo.com/">@Globo.com</a><br>Rio de Janeiro, RJ</p><p>O <em>Use Case</em> da globo.com foi o tópico apresentado por Raphael Porto. Ele participou da transição do antigo App da Globo que era um Native Wrapper com um Web View para React Native. Globo tem 5 apps diferentes, Globo.com, G1, GShow, GloboEsporte e Tech Tudo. Eles migraram 3 para React Native: G1, GloboEsporte e GShow. Entre os pontos fortes, conseguiram alcançar 98% de <em>crash free users</em> em suas plataformas. A palestra agregou conteúdo por não apresentar apenas seus pontos positivos, mas também por mencionar as dificuldades que encontraram, por exemplo, removeram o Code Push porque por vezes não conseguiram concluir 100% o <em>update</em> do <em>bundle</em>. Ao remover reduziu o tamanho do <em>bundle</em> final. Raphael explicou que conseguiram ter sucesso com React Native usando Apollo GraphQL, Fabric e Firebase Analytics.</p><p><a href="https://speakerdeck.com/raphaelpor/a-jornada-do-react-native-na-globo-dot-com">Slides</a></p><p><strong>React Native no Banco do Brasil: Como RN nos faz poupar 1500 horas por projeto<br></strong><a href="https://twitter.com/jirotheone">Guilherme Varandas</a><br>@<a href="https://www.bancobrasil.com.br/pbb/caw.jsp">Banco Do Brasil</a><br>Brasília, DF</p><p>Uma das apresentações que mais chamou atenção foi a do Guilherme, desenvolvedor no Banco do Brasil, ele ajuda a manter um App que faz 600 milhões de transações. Devido as dificuldades que se tem para fazer contratações em empresas públicas, eles precisaram se tornar mais produtivos. Para isso criaram um Container de Apps que chamam de GAM e que funciona como um grande Monorepo que faz <em>builds</em> independentes e gera APK/IPA, assim eles conseguem reutilizar <em>native bridges</em> e outros serviços internos. De acordo com Guilherme, com este <em>module</em><strong> </strong>é possível economizar 1500 horas dev por projeto.</p><p><a href="https://www.icloud.com/keynote/0zIJ9Nrzh5ELy-X1ZuzaJKKoQ#ReactConfBR_-_GAM">Slides</a></p><p><strong>Mantendo WebApps em produção sem dor de cabeça</strong><br><a href="https://twitter.com/hugoBessaa">Hugo Bessa</a><br>@Telnyx<br>Santos, SP</p><p>Hugo entrou no paradigma que encontramos em todos os projetos, como, pensar em como manter o projeto ao invés de criar. Não usar o ambiente de produção como <em>playground. </em>Reduzir o raio de impacto de errors entre outro pontos mencionado para não termos dor de cabeça.</p><p><a href="https://speakerdeck.com/hugobessaa/mantendo-webapps-em-producao-sem-dor-de-cabeca">Slides</a></p><p><strong>Docz: de 0 a5.000 ⭐️ em 2 semanas</strong><br><a href="https://twitter.com/pedronauck">Pedro Nauck</a><br>@Docz<br>Florianópolis, SC</p><p>Pedro deu um <em>deep dive</em> na história do Docz e o que o motivou a cria-lo. Falou sobre os desafios e a lista de regras que segue para fazer <em>open source</em> sustentavelmente. Sua <em>talk </em>foi marcada pelo pedido em casamento a sua namorada ❤️.</p><h3>Andrei Calazans on Twitter</h3><p>@pedronauck 9th tip for doing open source is having someone who loves and supports you. After that he asks his girlfriend to marry him ❤️ @ReactConfBR</p><p><a href="https://speakerdeck.com/pedronauck/reactconf-2018-presenting-docz">Slides</a></p><p><strong>Modeling GraphQL APIs</strong><br><a href="https://twitter.com/renatobenks">Renato Benkendorf</a><br>@Creditas<br>São Paulo, SP</p><p>Renato falou do momento que vive na creditas, estão quebrando o backend em vários serviços para integrar esses serviços com o cliente que é uma aplicação mobile, para isso estão construindo uma aggregation layer. Explicou como através de muito analise decidiram em usar GraphQL para compor dados entre serviços e export o domínio desses dados para múltiplos clientes entre múltiplos times. Concluirão que o GraphQL consegue lidar bem com estes cenários de escalabilidade e consegue expressar o domínio dos dados de forma coesa através de uma boa modelagem com grafos. Assim, explicaram o conceito por trás do GraphQL e depois deram alguns exemplos de má modelagens de dados e quais os impactos disso sem usar o conceito de grafos.</p><p><a href="https://speakerdeck.com/renatobenks/modeling-graphql-apis">Slides</a></p><p><strong>ReasonML levado a sério</strong><br><a href="https://twitter.com/Nexwire">Marcelo Camargo</a><br>@Rung<br>Joinville, SC</p><p>ReasonML não podia faltar. Marcelo falou sobres coisas lindas como <em>type safety</em> que ReasonML consegue introduzir no teu <em>code </em>base com a ajuda do oCalm.</p><p><a href="https://slides.com/marcelocamargo/react-conf-2018-reasonml#/">Slides</a></p><p><strong>Otimize seu bundle com Webpack 4 e Create React App</strong><br><a href="https://twitter.com/brunovhora">Bruno da Hora</a><br>@Pipefy<br>Curitiba, PR</p><p>Pipefy plataforma de processos que usa Webpack para lidar com seu <em>bundle. </em>Bruno se encarregou de apresentar como Webpack facilita e otimiza todo este processo. Ele deu dicas em como lidar com diferente ambientes, analisar <em>bundle</em>, usar <em>loaders</em> e os tipos de <em>code splitting</em> que são possíveis. Interessantemente com code splitting Pipefy obteve <strong>redução de 20% de load time e 75% de bundle size</strong>.</p><p><a href="https://docs.google.com/presentation/d/16mT9XjdhQx_0q94Qexfpx5q74dC5mt-OMz4IHRDjkVk/edit">Slides</a></p><p><strong>The Frontend Dichotomy</strong><br><a href="https://twitter.com/sseraphini">Sibelius Seraphini</a><br>@Entria<br>São Paulo, SP</p><p>A dicotomia do Front End foi o assunto abordado por Sibelius. Como lidar com pre-renderizações e pós renderizações, quais as propostas atuais para resolver estes desafios e como Time Slicing e Suspense pode auxiliar neste processo.</p><p><a href="https://twitter.com/sseraphini/status/1053952751418441728">Slides</a></p><p><strong>React nas trincheiras: Erros cometidos e lições aprendidas</strong><br>Maria Clara<br>@Picter<br>Maceió, AL</p><p>Como estruturar teu projeto? Partindo desta pergunta, Maria Clara compartilhou um pouco de sua experiência ao apresentar as decisões que toma em um projeto de React. Estruturação de pasta, gestão de estado, estilização e testes. Maria citou pontos importantes sobre CSS in JS, mencionou que <a href="https://en.wikipedia.org/wiki/JavaScript_Style_Sheets">ideia existe desde 1996</a> com a criação JSS pela netscape.</p><p><a href="https://speakerdeck.com/olarclara/react-nas-trincheiras">Slides</a></p><p><strong>Como escalar projetos React com Monorepo</strong><br><a href="https://twitter.com/nicholasess">Nicholas Eduardo</a><br>@Doolie<br>Florianópolis, SC</p><p>Nicholas começou explicando as diferentes maneiras de estruturar projetos. Como podemos ter Monolíticos, Micro-serviços e MonoRepo. Após explicar cada um ele fez um <em>deep dive</em> em Monorepo e como podemos gerencia-los com Lerna.</p><p><a href="https://docs.google.com/presentation/d/1jzNwlew9qy9czg34PCOy3z4lKw4KofLZSnbHulXe9E0/edit">Slides</a></p><p><strong>Animações com React Native</strong><br><a href="https://twitter.com/jabur_guilherme">Guilherme Jabur</a><br>@Foton<br>Florianópolis, SC</p><p>Jabur falou sobre animação em React Native. Ele mencionou as diferentes possibilidades que temos; Animated API, Animatable library e Lottie para alcançar qualquer tipo de animação.</p><p><a href="https://docs.google.com/presentation/d/1DwgfZ5aIxKnVIHEdUkZNxRgI3tlR80zdg7C2EC3Dqig/edit">Slides</a></p><p><strong>Meu próprio conjunto de regras para viver uma vida longa com <em>state containers</em></strong><br><a href="https://twitter.com/mtmr0x">Matheus Marsiglio</a><br>@mtmr0x<br>São Paulo, SP</p><p>Como ter garantias do modelo de dados que recebemos e dessa forma poder consumir dados na sua aplicação de forma agnóstica ao container de estado. Tirar proveito da flexibilidade do JavaScript. Entre outros pontos citados Matheus também explicou a estrutura de um container de estado que ele está criando chamado Nucleo, este que segue esses conjuntos de regras.</p><p><a href="https://www.icloud.com/keynote/0LZmoTka2s8xuTKJsEkUrniBA#happy-and-long-life-with-state-containers-pt">Slides</a></p><p>Para finalizar, tivemos um <em>open panel </em>entre participantes e palestrantes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jtzoJ67Qmkr1QBDCWbypJg.jpeg" /><figcaption>Open Panel</figcaption></figure><p>O evento foi muito bom! Todos pudemos fazer networking e trocar experiências. Agradeço a <a href="https://www.g2i.co/">G2i</a> por ter patrocinado minha participação. Para os que não conhecem, a <a href="https://www.g2i.co/">G2i</a> é uma plataforma de recrutamento/contratação gerenciada por engenheiros que conectam clientes com outros Engenheiros especializados em React, React Native, GraphQL e native iOS/Android.</p><p>Entre em contato comigo 😃</p><p><a href="https://github.com/AndreiCalazans">https://github.com/AndreiCalazans</a><br><a href="https://twitter.com/Andrei_Calazans">https://twitter.com/Andrei_Calazans</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=578ec5852bd1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reactbrasil/resumo-da-react-conf-brasil-2018-578ec5852bd1">Resumo da React Conf Brasil — 2018</a> was originally published in <a href="https://medium.com/reactbrasil">React Brasil</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Summary of React Conf Brazil — 2018]]></title>
            <link>https://medium.com/g2idev/summary-of-react-conf-brazil-2018-21038cd097d3?source=rss-8cd05be4062c------2</link>
            <guid isPermaLink="false">https://medium.com/p/21038cd097d3</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[brazil]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Fri, 26 Oct 2018 20:01:50 GMT</pubDate>
            <atom:updated>2018-10-26T20:17:48.270Z</atom:updated>
            <content:encoded><![CDATA[<h3>Summary of React Conf Brazil — 2018</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3KME7XmtZkdLzWWHbcR4cA.png" /><figcaption>React Conf Brazil</figcaption></figure><p>The second year of the biggest conference of React in Latin America gathered big names of the Brazilian React scene. This is a summary of everything that happened.</p><p>React Conf Brazil had impressive numbers this year, with 600 sold tickets and a waiting list. The event happened on October 20th, at <a href="https://www.google.com.br/maps/place/Teatro+Brigadeiro/@-23.5575587,-46.6410499,15z/data=!4m2!3m1!1s0x0:0x9881fcf1502b8deb?ved=2ahUKEwirgL3hsKDeAhUEg5AKHakiBn4Q_BIwF3oECAoQCw">Teatro Brigadeiro</a> São Paulo. Many companies participated and sponsored the event. It was a great place to network with developers from all over Brazil.</p><p><strong>Writing your own React Render</strong><br><a href="https://medium.com/u/9fee3779af5e">Raphael Amorim</a><br><a href="http://twitter.com/GoDaddyRio">@GoDadd</a>y <br>Rio de Janeiro, RJ</p><p>Raphael dived deep in the process of rendering with a React Component. Explaining the React.createElement and how the <strong>reconciler </strong>is used by the <strong>Virtual DOM</strong>. His focus was about customizing the <strong>Renderer,</strong> he made a React Renderer to render a song as ArrayBuffers. At the end Raphael announced his plan to release <a href="https://github.com/raphamorim/react-ape">react-ape</a>, a react renderer to build UI interfaces using canvas/WebGL.</p><p><strong>The power of SSR</strong><br><a href="https://medium.com/u/56a528c3eb78">Fernando Daciuk</a><br><a href="https://queroser.ninja/">@queroser.ninja</a><br>Curitiba, PR</p><p>Fernando Daciuk, Teacher and Developer. Deconstructed Server Side Rendering. At first he distinguished Client from Server side. Explained when we need SSR, it was interesting to learn that Google&#39;s indexing algorithm is capable of indexing client side rendered apps, but for other Search Engines and social network sites we still need SSR. He also talked about some pitfalls we can run into like not being in the same environment as the navigator, therefore not having access to the <strong>window</strong> keyword. At the end he mentioned the different solutions we have available to us.</p><p><a href="https://docs.google.com/presentation/d/1lY5u-TeYDVdg4rfd5uWub2EYC8QHNqbvnbtYOIQg_qs/present?slide=id.g440728cc19_0_619">Slides</a></p><p><strong>TypeScript vs Flow second semester of 2018</strong><br><a href="https://medium.com/u/5104cc745d52">Larissa Thaís de Farias</a><br><a href="http://www.vanhack.com/">@VanHack</a><br>Joinville, SC</p><p>Larissa discoursed about static typing in JavaScript, told us about her experience while working previously at Rung and now with Vanhack. With these experience she researched about which static typer to use. To summarise she explained why she chose TypeScript although Flow offers easier on-boarding for beginners. More info can be found on <a href="https://medium.com/rung-brasil/typescript-vs-flow-no-segundo-semestre-de-2018-54af2d4325d1">her post</a> about this talk.</p><p><a href="https://slides.com/larissathaisdefarias/typescript-vs-flow/">Slides</a></p><p><strong>A experience with open-source using React Native, GraphQL e Relay Modern</strong><br><a href="https://medium.com/u/1767240d4175">Luiz Fernando</a><br><a href="https://www.popstand.com/">@Popstand </a><br>São Paulo, SP</p><p>Luiz was in charge of making an App using React Native for the conference. In this talk he discussed the challenges he faced and decisions he made about the stack. App consisted of a React Native App consuming data with the help of Apollo on the client. It was interesting to hear Luiz&#39; explanation to why he migrated from Relay to Apollo.</p><p><a href="https://docs.google.com/presentation/d/1yBmaSl9aN8i6a5EpNGg7W9FiTgRBFScMx1KmxXaJZ8I/edit">Slides</a></p><p><strong>The journey of React Native at Globo.com<br></strong><a href="https://medium.com/u/dc774f79bd63">Raphael Porto</a><br><a href="http://globo.com/">@Globo.com</a><br>Rio de Janeiro, RJ</p><p>Globo.com’s use case was presented by Raphael Porto. He participated of the transition of a Web View app to React native. Globo has 5 different apps, Globo.com, G1, GShow, GloboEsporte and Tech Tudo. They have migrated 3 of them to React Native: G1, GloboEsporte and GShow. They saw their audience peek during the last few national/international sport events and elections. Within the strong points he mentioned was the ability to reach a 98% rate of crash free users, and huge usability gains after migrating away from WebViews. He also mentioned some negative experiences they ran into like with Code Push which they decided to drop.</p><p><a href="https://speakerdeck.com/raphaelpor/a-jornada-do-react-native-na-globo-dot-com">Slides</a></p><p><strong>React Native at Banco do Brasil: How RN made us save 1500 hours per project<br></strong> <a href="https://twitter.com/jirotheone">Guilherme Varandas</a><br>@<a href="https://www.bancobrasil.com.br/pbb/caw.jsp">Banco Do Brasil</a><br>Brasília, DF</p><p>One of the talks which caught the most attention was Guilherme&#39;s, a developer at Bank of Brazil, he helps maintain an App which does 600 million transactions. Due to difficulties with hiring since they are a partially state run company they needed to become more productive. To do this they made an App Container called GAM that works like a monorepo to make independent builds and generate APK/IPA. By doing this they inject native bridges and internal services as packages. According to Guilherme they are able to save up to 1500 hours of dev work per project.</p><p><a href="https://www.icloud.com/keynote/0zIJ9Nrzh5ELy-X1ZuzaJKKoQ#ReactConfBR_-_GAM">Slides</a></p><p><strong>Maintain WebApps in production without headaches</strong><br><a href="https://twitter.com/hugoBessaa">Hugo Bessa</a><br>@Telnyx<br>Santos, SP</p><p>The paradigms we see in all projects, how to think more towards maintainability and less in creation, not use your production environment as a playground, reduce the radius of impact due to errors and some other points were mentioned by Hugo for you to not have headaches.</p><p><a href="https://speakerdeck.com/hugobessaa/mantendo-webapps-em-producao-sem-dor-de-cabeca">Slides</a></p><p><strong>Docz: from 0 to 5.000 ⭐️ in 2 weeks</strong><br><a href="https://twitter.com/pedronauck">Pedro Nauck</a><br>@Docz<br>Florianópolis, SC</p><p>Pedro went over the short history of Docz and what motivated him to create it. Talked about the challenges and list of rules he follows to make open source work part of his life. His talk was remarked by him asking his girlfriend to marry him ❤️.</p><h3>Andrei Calazans on Twitter</h3><p>@pedronauck 9th tip for doing open source is having someone who loves and supports you. After that he asks his girlfriend to marry him ❤️ @ReactConfBR</p><p><a href="https://speakerdeck.com/pedronauck/reactconf-2018-presenting-docz">Slides</a></p><p><strong>Modeling GraphQL APIs</strong><br><a href="https://twitter.com/renatobenks">Renato Benkendorf</a><br>@Creditas<br>São Paulo, SP</p><p>Renato talked about how to model your GraphQL APIs in a scalable manner, see the slides for more information.</p><p><a href="https://speakerdeck.com/renatobenks/modeling-graphql-apis">Slides</a></p><p><strong>Taking ReasonML seriously</strong><br><a href="https://twitter.com/Nexwire">Marcelo Camargo</a><br>@Rung<br>Joinville, SC</p><p>We couldn&#39;t miss ReasonML, Marcelo talked about the beautiful things like type safety which ReasonML introduces to our code base with the help of OCalm.</p><p><a href="https://slides.com/marcelocamargo/react-conf-2018-reasonml#/">Slides</a></p><p><strong>Optimise your bundle with Webpack 4 and Create React App</strong><br><a href="https://twitter.com/brunovhora">Bruno da Hora</a><br>@Pipefy<br>Curitiba, PR</p><p>Pipefy is a process platform which uses Webpack to handle their bundle, Bruno was in charge of presenting about how Webpack facilitates and optimizes this process. He gave tips on how to deal with different environments, analyze bundle, use loaders and the types of code splitting we can do. Interesting to hear that with code splitting Pipefy obtained a reduction of 20% of load time and 75% of bundle size.</p><p><a href="https://docs.google.com/presentation/d/16mT9XjdhQx_0q94Qexfpx5q74dC5mt-OMz4IHRDjkVk/edit">Slides</a></p><p><strong>The Frontend Dichotomy</strong><br><a href="https://twitter.com/sseraphini">Sibelius Seraphini</a><br>@Entria<br>São Paulo, SP</p><p>The Front End dichotomy was Sibelius&#39; topic. How we deal with pre-rendering and deferring of the render, the current proposes to solve these issues with with time slicing and Suspense.</p><p><a href="https://twitter.com/sseraphini/status/1053952751418441728">Slides</a></p><p><strong>React in the trenches: Mistakes made and lessons learned</strong><br>Maria Clara<br>@Picter<br>Maceió, AL</p><p>How to structure your project, Maria Clara shared a bit about her experience to talk about the decisions she makes in a React Project. Folder structure, state management, styling, and tests. Maria cited an interesting fact about CSS in JS, this idea exists <a href="https://en.wikipedia.org/wiki/JavaScript_Style_Sheets">since 1996 and was introduced by Netscape as JSS.</a></p><p><a href="https://speakerdeck.com/olarclara/react-nas-trincheiras">Slides</a></p><p><strong>How to scale your React projects with Monorepo</strong><br><a href="https://twitter.com/nicholasess">Nicholas Eduardo</a><br>@Doolie<br>Florianópolis, SC</p><p>Nicholas started by explaining ways to structure your projects. How we can have Monolithic, Micro-services, and Monorepo. After explaining each one he deep dived into Monorepos and how we manage these with Lerna.</p><p><a href="https://docs.google.com/presentation/d/1jzNwlew9qy9czg34PCOy3z4lKw4KofLZSnbHulXe9E0/edit">Slides</a></p><p><strong>Animations with React Native</strong><br><a href="https://twitter.com/jabur_guilherme">Guilherme Jabur</a><br>@Foton<br>Florianópolis, SC</p><p>Jabur talked about animations in React native. He mentioned the different ways we can animate UI like with Animated API, Animatable library, and Lottie.</p><p><a href="https://docs.google.com/presentation/d/1DwgfZ5aIxKnVIHEdUkZNxRgI3tlR80zdg7C2EC3Dqig/edit">Slides</a></p><p><strong>My own set of rules to live a long life with state containers</strong><br><a href="https://twitter.com/mtmr0x">Matheus Marsiglio</a><br>@mtmr0x<br>São Paulo, SP</p><p>How to have guarantees of your data model, this way we can consume the state data safely. Always strive to have agnostic state, so we can change state management if necessary. Take advantage of JavaScript&#39;s flexibility. Between other points made Matheus also explained a state management library which he is working on called Nucleo, this library follows his set of rules.</p><p><a href="https://www.icloud.com/keynote/0LZmoTka2s8xuTKJsEkUrniBA#happy-and-long-life-with-state-containers-pt">Slides</a></p><p>To finish we had an open panel between participants and talkers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jtzoJ67Qmkr1QBDCWbypJg.jpeg" /><figcaption>Open Panel</figcaption></figure><p>The event was delightful we were able to do networking and exchange experiences. I&#39;m grateful for <a href="http://g2i.co/">G2i</a> for sponsoring my trip to React Conf Brazil. For those whom are unfamiliar, <a href="http://g2i.co/">G2i</a> is a hiring platform run by engineers that matches companies with pre-vetted React, React Native, GraphQL, and native iOS/Android focused engineers you can trust. Check them out!</p><p>Reach out to me 😃</p><p><a href="https://github.com/AndreiCalazans">https://github.com/AndreiCalazans</a><br><a href="https://twitter.com/Andrei_Calazans">https://twitter.com/Andrei_Calazans</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21038cd097d3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/summary-of-react-conf-brazil-2018-21038cd097d3">Summary of React Conf Brazil — 2018</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Which component to use in React?]]></title>
            <link>https://medium.com/g2idev/which-component-to-use-in-react-cf65a5efbf45?source=rss-8cd05be4062c------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf65a5efbf45</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Fri, 28 Sep 2018 21:48:29 GMT</pubDate>
            <atom:updated>2018-09-28T21:48:29.763Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RELqs1bS71U6_A3Q.jpg" /><figcaption>Building complex structures by blocks <a href="http://tumblr.som.com/post/160959090162/model-monday-building-with-legos-the-museum-of">http://tumblr.som.com/post/160959090162/model-monday-building-with-legos-the-museum-of</a></figcaption></figure><p>React introduces a component model to compose your UI. There are a couple of ways of rendering a component/JSX. You can use these simples rules to determine which way to write your component.</p><p>Note: This is a follow up article based on youtube screencast I made. check it out if you prefer watching. <a href="https://youtu.be/tIK8ndsC4SE">https://youtu.be/tIK8ndsC4SE</a></p><p><strong>The ways<br></strong>It&#39;s possible to write components using classes or functions. When using classes what we do is extend either React&#39;s Component or PureComponent.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4996ec6c22dfdd0dbc2a9736f26be967/href">https://medium.com/media/4996ec6c22dfdd0dbc2a9736f26be967/href</a></iframe><p>Both Component and PureComponent gives us access to React&#39;s state handler and lifecycles. The difference between both is PureComponent implements the <strong>shouldComponentUpdate </strong>lifecycle.</p><p>Components can also be any type of function as long as it returns a valid React Node.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a01f1ea3248eda03a8f752de9fe16826/href">https://medium.com/media/a01f1ea3248eda03a8f752de9fe16826/href</a></iframe><p>When using functions it&#39;s more common to use arrow functions assigned to a const variable.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f717a647b88db40eb812eacacb6710e1/href">https://medium.com/media/f717a647b88db40eb812eacacb6710e1/href</a></iframe><p><strong>Determine which to use<br></strong>We will use class components every time we need to use either lifecycles and/or state. That&#39;s why function components are regarded as Stateless Functional Components or Dumb Components.</p><p>Second, when we need a re-rendering aware component we should use a PureComponent or implement a class component with shouldComponentUpdate. Components can re-render every time props change, however, we might not always need that re-render. A common scenario is when the parent and a sibling component updates, this can cause a re-render. To avoid this you can leverage shouldComponentUpdate or just extend the PureComponent.</p><p>For every other case your component should be a Stateless Functional Component, it renders faster. With functional components you can use them in two ways. You can declare them in JSX as a regular component or call it as a function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d19a58aa6fbb252f160d07f6d4d0cb8f/href">https://medium.com/media/d19a58aa6fbb252f160d07f6d4d0cb8f/href</a></iframe><p>Both <strong>FunctionComponent</strong> and <strong>functionalComponentTwo</strong> could be written the same way, just remembering how you would access props, as a JSX component the props are passed as an object to the first argument of the FunctionComponent, while calling a function you would pass your props as arguments to the function then access it as usual.</p><p><a href="https://www.peterbe.com/plog/component-or-function-in-react">This article by Peter</a> does a benchmark between Class Components, Function Components, and regular Functions. A regular function is the fastest, however, it&#39;s just 1ms faster which would not really impact the overall performance. Since a Function Component gets instantiated as a class component behind the scenes, it&#39;s just 14% faster than a class component, React&#39;s core team have stated their intentions to optimise Function Components, although there has been no plan to when.</p><h3>Dan Abramov on Twitter</h3><p>@ggrgur There is no &quot;optimized&quot; support for them yet because stateless component is wrapped in a class internally. It&#39;s same code path.</p><p>To keep consistency always use your Stateless Function Components as JSX components instead of functions in JSX. But here is a scenario where it might be interesting to simply call a function inside JSX. When breaking down the render method, in cases where your JSX tree can be broken down into parts, you can do as follow.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d50cf27464ba7ed7a2ad5a5717df8388/href">https://medium.com/media/d50cf27464ba7ed7a2ad5a5717df8388/href</a></iframe><p>If you aren&#39;t accessing values from the either the state or props you don&#39;t need to instantiate it within the class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/295797218b6f0392ca4ba052f3db1049/href">https://medium.com/media/295797218b6f0392ca4ba052f3db1049/href</a></iframe><p>Another case where we see a function being called inside JSX is when using a Function as Child Component pattern, however I won&#39;t cover this on this post. <a href="http://rea.tech/functions-as-child-components-and-higher-order-components/">Here is a link</a> if you want to learn about it.</p><p>Thanks for reading, I’m Andrei Calazans a Software Developer at <a href="https://www.g2i.co/for-companies/remote">G2i</a> who is in love with learning and teaching. Feel free to reach out and chat.</p><p><a href="https://github.com/AndreiCalazans">https://github.com/AndreiCalazans</a><br><a href="https://twitter.com/Andrei_Calazans">https://twitter.com/Andrei_Calazans</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf65a5efbf45" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/which-component-to-use-in-react-cf65a5efbf45">Which component to use in React?</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>