<?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[Orionsoft - Medium]]></title>
        <description><![CDATA[React and GraphQL - Medium]]></description>
        <link>https://medium.com/orionsoft?source=rss----8d9688e0f7f0---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Orionsoft - Medium</title>
            <link>https://medium.com/orionsoft?source=rss----8d9688e0f7f0---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 10:37:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/orionsoft" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Easy deployment of create-react-app to S3 and CloudFront]]></title>
            <link>https://medium.com/orionsoft/easy-deployment-of-create-react-app-to-s3-and-cloudfront-f511476b02a1?source=rss----8d9688e0f7f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/f511476b02a1</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloudfront]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Nicolás López Jullian]]></dc:creator>
            <pubDate>Wed, 26 Sep 2018 16:46:06 GMT</pubDate>
            <atom:updated>2018-09-26T16:10:43.629Z</atom:updated>
            <content:encoded><![CDATA[<p>The create-react-app package lets you create React apps with no build configuration. It’s widely used and the deployments options are many.</p><p>For me the best option is CloudFront, the CDN from AWS. It’s very cheap, it’s fast and has features like free SSL, HTTP/2.0 and more. The problem: it’s really complicated to configure.</p><h4>Introducing <a href="https://waveshosting.com/">Waves Hosting</a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*JrbirptfWvnqUgIlAYdChw.png" /></figure><p>Waves hosting is a platform that connects your AWS account and gives you a powerful dashboard that extremely easy to use.</p><p>Waves work for servers and static websites, like create-react-app’s.</p><p>To deploy your first static website you must first create an account in Waves and <a href="https://support.waveshosting.com/getting-started/how-to-connect-your-amazon-web-services-account">connect your AWS account</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8u0EsWNbQhOLaps11glNNA.png" /></figure><p>Then create the app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PBDtGh0Maelau955Dj3K8g.png" /></figure><p>Create a new environment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UckjutddhBWmtpCTqol36Q.png" /></figure><p>Now you are ready to deploy your first version. Install the waves-cli (yarn global add waves-cli) and run waves upload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8WvNWC4_DBNDuYQNZj3XSg.png" /></figure><p>Your app will be built and uploaded, just wait and deploy it to your environment.</p><p>In your environment configure the domains and select a free SSL certificate to enable https.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AeWBOaKNnVAjbU9EZTxAVA.png" /></figure><p>To finish, point your domain to the CloudFront cname record and wait for CloudFront to finish the deployment. The first deployment takes about 10 minutes, but the next ones are made instantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3CwgHx7gHc2758ft7FuzAA.png" /></figure><p><a href="https://waveshosting.com/">Waves</a> is growing very fast and soon it will have more features. It’s free for one app, but if you need more you can pay the unlimited version at $29/month and you can use the coupon code <strong>CREATEREACTAPP</strong> to get 3 month of 50% off.</p><p>If you have any doubt in the process, please ask on the chat box in the website.</p><p><a href="https://waveshosting.com/">waveshosting.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f511476b02a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orionsoft/easy-deployment-of-create-react-app-to-s3-and-cloudfront-f511476b02a1">Easy deployment of create-react-app to S3 and CloudFront</a> was originally published in <a href="https://medium.com/orionsoft">Orionsoft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Meteor App to Orion Hosting]]></title>
            <link>https://medium.com/orionsoft/deploying-a-meteor-app-3b5113834f94?source=rss----8d9688e0f7f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/3b5113834f94</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[meteor]]></category>
            <category><![CDATA[orion-hosting]]></category>
            <category><![CDATA[orionsoft]]></category>
            <category><![CDATA[hosting]]></category>
            <dc:creator><![CDATA[Rodrigo Cisternas]]></dc:creator>
            <pubDate>Wed, 10 May 2017 19:37:16 GMT</pubDate>
            <atom:updated>2017-05-14T01:35:45.491Z</atom:updated>
            <content:encoded><![CDATA[<p>In this guide we will walk you through the process of creating a new app and deploying it to <a href="https://orion.hosting/?utm_source=orion-blog&amp;utm_campaign=deploy-meteor-apps">Orion Hosting</a>.</p><p>Once you have logged in into the <a href="https://dashboard.orion.hosting/?utm_source=orion-blog&amp;utm_campaign=deploy-meteor-apps">Orion Hosting Dashboard</a> create your first app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ehk765YrnW2m6qQGtt3KYw.png" /></figure><p>Next step is to connect your GitHub account. This is how we know where to pull your code from.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6weMMhhkjQBHyfaDNJIAuw.png" /></figure><p>Once you’ve successfully linked your GitHub account you’ll be able to choose what code to use for your app.</p><p>Have several organizations? No problem at all you can choose what organization and which repository to use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aZoJrp3ngu6eOfDCIofc1Q.png" /></figure><p>Last but not least select the region you want your app to be deployed to. Once you’ve press CREATE APP you will be able to choose your framework. OrionHosting sometimes can infer what kind of app you’ve have chosen in our case Meteor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Eq-4S-X5eQ3XqjmhewKrLA.png" /></figure><p>Choose Meteor and go next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KzQ68EEoGlOVP_qvbmtX4Q.png" /></figure><p>Next step: Configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDIOPRDf_jm1IiSOcBe7iw.png" /></figure><p>Choose pricing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Y2PrXtby0Nv_hVwJzxlGQ.png" /></figure><p>We’re almost there press deploy and wait a couple seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PCdqeuuKQDFNOmCQh3Tgow.png" /></figure><p>If you see a box with a loading indicator you can go ahead and check the activity tab<br>Press the console button to see the logs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7lBR8Mc2wotxZabvA6BrTg.png" /></figure><p>Congratulations!! You’re app is being deployed! 😃<br>Check the logs. <br>Once it’s finished you’ll be able to visit your meteor application using the link provided on the Settings tab</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FCgCNA0BLDvCp4RzeGMdSQ.png" /></figure><p><a href="https://orion.hosting/?utm_source=orion-blog&amp;utm_campaign=deploy-meteor-apps">Go to Orion Hosting</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b5113834f94" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orionsoft/deploying-a-meteor-app-3b5113834f94">Deploying a Meteor App to Orion Hosting</a> was originally published in <a href="https://medium.com/orionsoft">Orionsoft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Meteor Accounts with Apollo and React part 1]]></title>
            <link>https://medium.com/orionsoft/using-meteor-accounts-with-apollo-and-react-df3c89b46b17?source=rss----8d9688e0f7f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/df3c89b46b17</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[meteor]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[apollostack]]></category>
            <dc:creator><![CDATA[José G. Andradez]]></dc:creator>
            <pubDate>Thu, 15 Dec 2016 18:48:44 GMT</pubDate>
            <atom:updated>2017-01-17T23:03:54.102Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ny3MCwTtvbe6BzHmh6kPHQ.jpeg" /></figure><p>Let&#39;s see the module <a href="https://github.com/nicolaslopezj/meteor-apollo-accounts">meteor-apollo-accounts </a>in action, I will show you how to use it on the server and call the mutation methods from graphiql, then we’ll see how to use those methods in react.</p><p>Let&#39;s generate a new project in which we will have both a backend folder and a frontend folder.</p><p>We begin by creating a new folder, lets call it ‘apollo-accounts-react’ so we type the commands:</p><pre>mkdir apollo-accounts-react <br>cd apollo-accounts-react</pre><p>Create a new meteor app (lets name it backend, because we will have a separate frontend app in react)</p><pre>meteor create backend</pre><p>Once it was created we need to install the project dependencies. We use yarn as package manager so this post will refer to yarn when installing and running scripts but you can run the equivalent instruction in npm and it will work.</p><pre>yarn</pre><p>Add apollo</p><p><strong>Note: </strong>At the moment of writing this tutorial the official apollo has some problems with the context on the server side so we use our own fork.</p><pre>meteor add orionsoft:apollo</pre><p>Add meteor accounts password</p><pre>meteor add accounts-password</pre><p>Also add the bcrypt package so that meteor won’t warn us about the javascript implementation all the time.</p><pre>meteor npm install --save bcrypt</pre><p>Add graphql-compiler so that Meteor can compile .graphql files into usable modules.</p><pre>meteor add orionsoft:graphql-compiler</pre><p>Add meteor-apollo-accounts</p><pre>meteor add nicolaslopezj:apollo-accounts</pre><p>(at the time of writing this, meteor installed the version 1.1.0 so I needed to explicitly tell meteor to install the version 2.1.0, make sure your version is the same or higher)</p><pre>meteor add nicolaslopezj:apollo-accounts@2.1.0</pre><p>Install graphql and other dependencies</p><pre>yarn add graphql graphql-tools graphql-server-express body-parser express cors</pre><p>Once we have all the dependencies installed we can start to set up the apollo graphql server.</p><p>Create a folder called imports inside the server folder</p><pre>cd server<br>mkdir imports<br>cd imports</pre><p>Create an index file with this content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/80c39e93d26645400f3347f0f5d4ff7f/href">https://medium.com/media/80c39e93d26645400f3347f0f5d4ff7f/href</a></iframe><p>In this file we create an Apollo server.</p><p>notice we use CORS so that the api can be queried from other ports or computers (we’ll need it to query from the react app).</p><p>we define where to find the typeDefs and resolvers so that Apollo know how to handle the queries.</p><p>Don’t forget add the reference to the import folder in the main.js file of the server folder.</p><pre>import ‘./imports’</pre><p>Create an index.js file inside of a new folder called schema located in the imports folder with this content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/036b9a1e0ec5c752c940ce2e5d3cd8c6/href">https://medium.com/media/036b9a1e0ec5c752c940ce2e5d3cd8c6/href</a></iframe><p>Notice we import the types needed by the apollo-accounts module and export it along with the definitions for User and Query as an array of types.</p><p>We want to know who is the user that is connected so we define a field called ‘me’ which will tell us if a user is logged in (and who it is).</p><p>So we define the Query type in like this:</p><p>schema/Query.graphql</p><pre># Main type (the root of all queries)<br>type Query {<br> me:User<br>}</pre><p>then we define the types for User</p><p>schema/User.graphql</p><pre># Defines a user type and its fields<br>type User {<br> _id: ID<br> emails: [Email]<br> profile: UserProfile</pre><pre>}</pre><pre># Defines a user profile type and its fields<br>type UserProfile {<br> name: String<br>}</pre><pre># defines Email type and its fields<br>type Email {<br> address: String<br> verified: Boolean<br>}</pre><p>We have defined the query we want to make available and the types associated to it, but we also need some mutations of the apollo-accounts module available, we will import them in this file:</p><p>schema/Mutation/index.js</p><pre>import {SchemaMutations as Auth} from ‘meteor/nicolaslopezj:apollo-accounts’</pre><pre>export default `<br>type Mutation {<br> ${Auth()}<br>}<br>`</pre><p>Done with the schema, lets deal with our resolvers now. Remember we have a reference to resolvers in the /server/imports/index.js file?</p><p>Begin by creating the server/imports/resolvers/index.js file and adding this content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b1fc5389cf44ed5cb82895c1e115ea8/href">https://medium.com/media/7b1fc5389cf44ed5cb82895c1e115ea8/href</a></iframe><p>Lets add the Mutations resolvers we need from the apollo-accounts module.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3374c22b388a18908ce2ebd5c3f389d/href">https://medium.com/media/b3374c22b388a18908ce2ebd5c3f389d/href</a></iframe><p>Now we define how to get the data we want in the ‘me’ field of the query, let’s first import the resolver function to the index.js file on the Query folder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc999af83b26e4518e145ba9fa56b711/href">https://medium.com/media/dc999af83b26e4518e145ba9fa56b711/href</a></iframe><p>Now the actual ‘me’ resolver looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4019f8ee63a586b8aef59116ddca5af6/href">https://medium.com/media/4019f8ee63a586b8aef59116ddca5af6/href</a></iframe><p>At this point we can start the meteor server. To take a look at the api hit the url: <a href="http://localhost:3000/graphiql">http://localhost:3000/graphiql</a> , take a look at the documentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*F-0qB6MkMCQKdawl2GDtSQ.png" /></figure><p>See? we have our query and out mutations, we can see that we have all of the apollo-accounts mutations available for us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*4rhYNlcRVPHZ5u13_afElA.png" /></figure><p>Also this is how the query looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*r4QvHwiP_9tsfrEPTP57fQ.png" /></figure><p>Lets try to query ‘me’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*DQMZVfefgjMXMf4fM-REhg.png" /></figure><p>Oh right we are not logged in, so we get the error “Unknown user (not logged in)”</p><p>So we don’t have any user created, let’s create one, for this we use the mutation createUser we made available from apollo-accounts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*jFjFBp7vtkJcIjSdj3Gs9Q.png" /></figure><p>We successfully created a new user, Lets try to log in with this data. For this we use the loginWithPassword mutation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*j9HaIKl4XX0EpzV48-PaSg.png" /></figure><p>Great, now we are logged in, let’s try to query ‘me’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*ut8AFyC7F6V5Zk_CPyvZEQ.png" /></figure><p>Wait, why do we have an error back if we already have logged in?</p><p>GraphiQL doesn’t save the token in Local Storage, we need to save it manually so go to your browser’s Local Storage tab and add Meteor.loginToken like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*_xIjVLQkjkcUfTqSpVpy9A.png" /></figure><p>After we’ve done this we can successfully query ‘me’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*Bg_8WgxDdTNF49-XAGeHCg.png" /></figure><p>you can find the code here in the branch part1-tutorial: <a href="https://github.com/HERRKIN/meteor-apollo-accounts-react-example/tree/part_1_tutorial">https://github.com/HERRKIN/meteor-apollo-accounts-react-example/tree/part_1_tutorial</a></p><p>So far we have just covered the authentication part of this tutorial, in part 2 we’ll see how to create the api to create a todo list app.</p><p>part2: <a href="https://medium.com/p/c153368e94a8">https://medium.com/p/c153368e94a8</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df3c89b46b17" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orionsoft/using-meteor-accounts-with-apollo-and-react-df3c89b46b17">Using Meteor Accounts with Apollo and React part 1</a> was originally published in <a href="https://medium.com/orionsoft">Orionsoft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A better API for Apollo GraphQL and React]]></title>
            <link>https://medium.com/orionsoft/a-better-api-for-apollo-graphql-and-react-ed2b1f45b13c?source=rss----8d9688e0f7f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/ed2b1f45b13c</guid>
            <category><![CDATA[apollo]]></category>
            <category><![CDATA[apollostack]]></category>
            <category><![CDATA[meteor]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Nicolás López Jullian]]></dc:creator>
            <pubDate>Wed, 12 Oct 2016 23:50:15 GMT</pubDate>
            <atom:updated>2016-10-13T01:50:50.571Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WVJxAc0JZL5_qxtQp6D9uA.jpeg" /></figure><p><em>Disclaimer: when I say better it’s better for me, anyone can disagree.</em></p><p>While I was implementing the apollo stack in my Meteor project I was very happy with Apollo and GraphQL in general. But when I finished learning I wasn’t completely happy with the graphql decorator that comes with the react-apollo module, So I created a decorator that has small changes, works on top of the one provided and feels more natural.</p><h4>Things I don’t like about the original decorator:</h4><ul><li>Data comes in the data prop and I want components to be agnostic on how I fetch the data, so if I fetch user data, I want it on the user prop.</li><li>Query variables were always the same that I passed to the component. I didn’t want to “map” every time the props to variables.</li><li>When doing mutations, I didn’t want to receive the function named <em>mutate</em>, instead I want the function by it’s name.</li><li>I want to pass the mutate function variables as the first argument, like calling the function I defined in the query, not passing a object with the variables in the variables key.</li><li>No easy support for fragments.</li></ul><p>Time passed and I ended with 3 decorators: withGraphQL, withMutation and withFragment. Each one with differences from the original one.</p><p>The result of this is on <a href="https://github.com/nicolaslopezj/react-apollo-decorators">github.com/nicolaslopezj/react-apollo-decorators</a>, a package that provides this three decorators, and solves those small problems I was having with the original decorator of Apollo and React.</p><h4><strong>Some examples:</strong></h4><ul><li>No need to map props:</li></ul><pre>/* Before */<br>export default graphql(query, {<br>  options: ({ avatarSize }) =&gt; ({ variables: { avatarSize } })<br>})(Component)</pre><pre>/* After */<br>export default withGraphQL(query)(Component)</pre><ul><li>Data is not passed into data prop:</li></ul><pre>/* Before */<br>class Profile extends React.Component {<br>  render () {<br>    return &lt;div&gt;{this.props.data.currentUser.login}&lt;/div&gt;<br>  }<br>}</pre><pre>/* After */<br>class Profile extends React.Component {<br>  render () {<br>    return &lt;div&gt;{this.props.currentUser.login}&lt;/div&gt;<br>  }<br>}</pre><ul><li>Fragments</li></ul><pre>// Main.js<br>import withGraphQL from &#39;react-apollo-decorators/lib/withGraphQL&#39;<br>import gql from &#39;graphql-tag&#39;<br>import Content from &#39;./Content&#39;</pre><pre><a href="http://twitter.com/withGraphQL">@withGraphQL</a>(gql`query getMyData ($section: String) {<br>  dataForSection (section: $section) {<br>    ...${Content.fragmentName}<br>  }<br>}`, {<br>  fragments: [...Content.fragment]<br>})<br>export default class Main extends React.Component {</pre><pre>}</pre><pre>// Content.js<br>import React from &#39;react&#39;<br>import withFragment from &#39;react-apollo-decorators/lib/withFragment&#39;<br>import gql from &#39;graphql-tag&#39;</pre><pre><a href="http://twitter.com/withFragment">@withFragment</a>(gql`fragment dataContent on Data {<br>  title<br>  description<br>}`)<br>export default class Content extends React.Component {</pre><pre>}</pre><ul><li>Calling mutation by its name</li></ul><pre>/* Before */<br><a href="http://twitter.com/withMutation">@withMutation</a>(gql`mutation save ($title: String, $description: String) {<br>  saveData (title: $title, description: $description) {<br>    title<br>    description<br>  }<br>}`)<br>class Save extends React.Component {</pre><pre>async save () {<br>    try {<br>      const result = await this.props.mutate({<br>        title: this.state.title,<br>        description: this.state.description<br>      })<br>      console.log(&#39;Success&#39;, result.data.saveData)<br>    } catch (error) {<br>      console.log(&#39;Error&#39;, error)<br>    }<br>  }</pre><pre>}</pre><pre>/* After */<br><a href="http://twitter.com/withMutation">@withMutation</a>(gql`mutation save ($title: String, $description: String) {<br>  saveData (title: $title, description: $description) {<br>    title<br>    description<br>  }<br>}`)<br>class Save extends React.Component {</pre><pre>async save () {<br>    try {<br>      const result = await this.props.save({<br>        title: this.state.title,<br>        description: this.state.description<br>      })<br>      console.log(&#39;Success&#39;, result.saveData)<br>    } catch (error) {<br>      console.log(&#39;Error&#39;, error)<br>    }<br>  }</pre><pre>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed2b1f45b13c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orionsoft/a-better-api-for-apollo-graphql-and-react-ed2b1f45b13c">A better API for Apollo GraphQL and React</a> was originally published in <a href="https://medium.com/orionsoft">Orionsoft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Meteor methods on React components to fetch data]]></title>
            <link>https://medium.com/orionsoft/using-meteor-methods-on-react-components-to-fetch-data-8f98431a6252?source=rss----8d9688e0f7f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/8f98431a6252</guid>
            <category><![CDATA[meteorjs]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[meteor]]></category>
            <dc:creator><![CDATA[Joaquin Gumucio L]]></dc:creator>
            <pubDate>Fri, 02 Sep 2016 17:51:19 GMT</pubDate>
            <atom:updated>2016-09-02T17:43:29.593Z</atom:updated>
            <content:encoded><![CDATA[<p>Continuing with the practical <a href="https://medium.com/orionsoft/using-decorators-to-fetch-meteor-data-in-react-419a6869400c#.be7bt078g">use of decorators to fetch data</a> from a Meteor server in React components, we have figured out yet another way to take advantage of the <a href="https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841#.wqdotzfls">decorator pattern</a>.</p><p>We have seen (<a href="https://medium.com/orionsoft/using-decorators-to-fetch-meteor-data-in-react-419a6869400c#.be7bt078g">previous post</a>) that we can decorate a component to subscribe and fetch data. This approach really simplifies the process and allows for &quot;data-fetching&quot; composition.</p><p>Very well, whats the new part? Here we go, if your are not aware of the lifecycle of the <a href="https://guide.meteor.com/data-loading.html#lifecycle">subscription process</a>, there are a lot of things going on under the hood. All this &quot;micro&quot; processes load our server for the sake of keeping data in sync and allows for reactivity changes.</p><p><strong>What if we need to fetch data from the server but we don&#39;t actually need/care about reactivity for this piece of data?</strong></p><p>We don&#39;t want to waste resources and overload our server with functionality we won&#39;t use. Enter the new decorator of <a href="https://github.com/orionsoft/react-meteor-data">orionsoft:react-meteor-data</a>, <a href="https://github.com/orionsoft/react-meteor-data/blob/master/with-method-data.js"><strong>withMethodData</strong></a>. This new decorator allows us to fetch this kind of data without the overhead of the subscription process. Lets see it in action:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93369fa6bc176fa005a44d2db343da83/href">https://medium.com/media/93369fa6bc176fa005a44d2db343da83/href</a></iframe><p>Note that the <a href="https://github.com/orionsoft/react-meteor-data/blob/master/with-method-data.js"><strong>withMethodData</strong></a> will re-run when the decorated component changes its props.</p><p>We can keep <strong>reusing and composing data fetch functionality</strong>, just like shown in the previous post. You can even mix decorators using <a href="https://github.com/orionsoft/react-meteor-data/blob/master/with-data.js"><strong>withData</strong></a> and <a href="https://github.com/orionsoft/react-meteor-data/blob/master/with-method-data.js"><strong>withMethodData</strong></a> to decorate components:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/055bd387686f602b5d1d92bfa7c34e3e/href">https://medium.com/media/055bd387686f602b5d1d92bfa7c34e3e/href</a></iframe><p>This way we can save resources on our server and still get the data we need for our components.</p><p>Another big advantage is that we can forget about the overhead and boilerplate code that needs to be declared on each component that fetchs data using a method (on components that are not decorated). We get these from the decorator:</p><ul><li>constructor</li><li>componentWillReceiveProps</li><li>componentWillMount</li><li>data fetching method in the component (the one that calls Meteor.call())</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f98431a6252" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orionsoft/using-meteor-methods-on-react-components-to-fetch-data-8f98431a6252">Using Meteor methods on React components to fetch data</a> was originally published in <a href="https://medium.com/orionsoft">Orionsoft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using decorators to fetch Meteor data in React]]></title>
            <link>https://medium.com/orionsoft/using-decorators-to-fetch-meteor-data-in-react-419a6869400c?source=rss----8d9688e0f7f0---4</link>
            <guid isPermaLink="false">https://medium.com/p/419a6869400c</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[meteor]]></category>
            <dc:creator><![CDATA[Nicolás López Jullian]]></dc:creator>
            <pubDate>Tue, 30 Aug 2016 13:59:38 GMT</pubDate>
            <atom:updated>2016-08-30T13:59:37.611Z</atom:updated>
            <content:encoded><![CDATA[<p>The other day I was learning about decorators (check <a href="https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841#.3euflxeuk"><em>this post</em></a> to learn about the pattern), and an idea came to my mind… This should be <em>the</em> way to fetch data in Meteor!</p><p>In case you didn’t know, decorators are a new feature introduced in ES7 that allows us to add “magic” to our classes (mostly React components) and functions.</p><p>At this point we are in the second version of the accepted way of fetching Meteor data and this is the next step. This is not a game changer, but is a new syntax that incorporates the new JS features and doesn’t break anything.</p><p>So, let’s start. This is how we fetch Meteor data now:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d9cbd665e636b6beacfabb42732ab94/href">https://medium.com/media/1d9cbd665e636b6beacfabb42732ab94/href</a></iframe><p>And in this is new way, using <a href="https://github.com/orionsoft/react-meteor-data">orionsoft:react-meteor-data</a>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f528267b8d228b2ba1f2634cbc2d659/href">https://medium.com/media/6f528267b8d228b2ba1f2634cbc2d659/href</a></iframe><p>This new pattern <strong>allow us to make reusable and composable data fetchs</strong>, like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6462c79d5d259114b8d54a7750483063/href">https://medium.com/media/6462c79d5d259114b8d54a7750483063/href</a></iframe><p>PD: If you liked decorators, I’m sure you will also like this awesome and simple decorator that binds our functions in React, <a href="https://github.com/andreypopp/autobind-decorator">autobind-decorator</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=419a6869400c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orionsoft/using-decorators-to-fetch-meteor-data-in-react-419a6869400c">Using decorators to fetch Meteor data in React</a> was originally published in <a href="https://medium.com/orionsoft">Orionsoft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>