<?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 Can Aras on Medium]]></title>
        <description><![CDATA[Stories by Can Aras on Medium]]></description>
        <link>https://medium.com/@canaras?source=rss-5c1320829986------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wCEheHJmY073SYw4W7C-Cg@2x.jpeg</url>
            <title>Stories by Can Aras on Medium</title>
            <link>https://medium.com/@canaras?source=rss-5c1320829986------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 04:23:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@canaras/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[React Formik Multi-Step Form with Dynamic Routing]]></title>
            <link>https://canaras.medium.com/build-react-formik-multi-step-form-with-dynamic-routing-d64aaf19e565?source=rss-5c1320829986------2</link>
            <guid isPermaLink="false">https://medium.com/p/d64aaf19e565</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[multi-step-form]]></category>
            <category><![CDATA[dynamic-routing]]></category>
            <category><![CDATA[formik]]></category>
            <category><![CDATA[react-router]]></category>
            <dc:creator><![CDATA[Can Aras]]></dc:creator>
            <pubDate>Sat, 24 Apr 2021 15:18:51 GMT</pubDate>
            <atom:updated>2021-04-24T15:20:03.150Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build a React Formik Multi-Step Form with Dynamic Routing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Db6Yeyk3jqR1BodtCYQPEg.png" /><figcaption>Routing Schema</figcaption></figure><blockquote>You can find the whole code on my Github and CodeSandbox :</blockquote><blockquote>Github: <a href="https://github.com/arascan35/react-multi-step-form-dynamic-route">https://github.com/arascan35/react-multi-step-form-dynamic-route</a><br>CodeSandBox: <a href="https://codesandbox.io/s/react-multi-step-form-s19v6">https://codesandbox.io/s/react-multi-step-form-s19v6</a>?</blockquote><h3>Introduction</h3><p>This guide provides building a basic multi-step form with Formik and React Router. The main purpose is URL changing with next and previous actions in the form.</p><h3>Overview</h3><p>We have a simple folder structure. The project contains 3 main parts which are <strong>index.js</strong>, <strong>App.js</strong> and <strong>Components </strong>folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*to8gvaK7IK_rhGdEfWjr_Q.png" /><figcaption>Folder structure</figcaption></figure><ul><li><strong>index.js: </strong>This file comes from create-react-app as a default. The only thing which is we need to add BrowserRouter component.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb8557c800b39babf8b230eaf7def780/href">https://medium.com/media/cb8557c800b39babf8b230eaf7def780/href</a></iframe><ul><li><strong>App.js</strong>: Our form component starts from here. In the below code you can see the basic Formik form structure. Formik’s <strong>Form </strong>component wrap form fields thus the form values are managed. However, in our case <strong>Form </strong>component must wrap <strong>Routes.</strong></li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ee0db396b57b24b4bfe3df055411f02/href">https://medium.com/media/7ee0db396b57b24b4bfe3df055411f02/href</a></iframe><ul><li><strong>Components: </strong>In this folder, we have form pages. Each file represents a different form step.</li></ul><h3>Handle Routing</h3><p>Before starting handle routing we should declare all routes for each condition. I listed these routes under the <strong>Routes.js</strong> file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4273826ae0abdee070472db4db47982/href">https://medium.com/media/b4273826ae0abdee070472db4db47982/href</a></iframe><p>Also, we will need all paths for each condition. These paths will be using for next() and previous() functions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd1ddba93ee344a1e2009f6d59846cca/href">https://medium.com/media/cd1ddba93ee344a1e2009f6d59846cca/href</a></iframe><p>The main thing is the form follows routes in the <strong>steps</strong> array state. So, when we update the <strong>steps </strong>array, we also update our route. We are using <strong>activeStep </strong>state to find out which step we are in.</p><h4>Update Steps State</h4><p>As we can see in the <em>Routing Schema, </em>the form starts in /. The first page is the same for all conditions, for this reason, we can redirect the URL to /form/user-info .</p><p>Our conditional value is status . When the status variable change, the steps state should be updated. To update the status states, <strong>setSteps </strong>function sends to <strong>UserInfo </strong>components as a prop.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c56ef0a929ba9c9f2fce930ac60a7aaf/href">https://medium.com/media/c56ef0a929ba9c9f2fce930ac60a7aaf/href</a></iframe><p>We should edit the field component which is using for the status value set. The goal is to update the steps state before the selection is completed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b7d4422dcecc7236183abb3b3fc46264/href">https://medium.com/media/b7d4422dcecc7236183abb3b3fc46264/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*wS3a_5cobsgTOb4pO_5y6g.gif" /></figure><h4>Update Route</h4><p>So far we updated the steps state and status variable. Now, we should check the status variable and decide to which routes choose.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e25f5ef9bdf3a0c665f9f10f9b36beb/href">https://medium.com/media/1e25f5ef9bdf3a0c665f9f10f9b36beb/href</a></iframe><h4>Next and Previous</h4><p>If you are familiar with the Formik forms you know that the active step manages with a simple React state. We will use this state for the select to route path from the steps array.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4222f1df17f39e9e24ff858044334bf/href">https://medium.com/media/d4222f1df17f39e9e24ff858044334bf/href</a></iframe><h4>Submit Form</h4><p>In the Formik form, next or submit buttons type have to be submit. Because when the buttons click, the form has to be validated. In this example, I did not add any validation, if you want you can add validate the form using <a href="https://formik.org/docs/guides/validation">validationSchema</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b053575e885c6b22e1110f654b99fef/href">https://medium.com/media/3b053575e885c6b22e1110f654b99fef/href</a></iframe><p>That’s it! We created a Formik form that has a dynamic routing.</p><p>Happy Coding :)</p><h3>Sources</h3><p><a href="https://medium.com/@nphivu414/build-a-multi-step-form-with-react-hooks-formik-yup-and-materialui-fa4f73545598">Build a multi-step form with React Hooks, Formik, Yup and MaterialUI</a></p><p><a href="https://codedaily.io/tutorials/Create-a-Form-Wizard-with-Data-Loss-Prevention-using-Formik-and-React-Router">https://codedaily.io/tutorials/Create-a-Form-Wizard-with-Data-Loss-Prevention-using-Formik-and-React-Router</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d64aaf19e565" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native , AWS Amplify & AWS AppSync GraphQL API]]></title>
            <link>https://canaras.medium.com/react-native-aws-amplify-aws-appsync-graphql-api-b10c7df5ba7e?source=rss-5c1320829986------2</link>
            <guid isPermaLink="false">https://medium.com/p/b10c7df5ba7e</guid>
            <category><![CDATA[aws-appsync]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[aws-amplify]]></category>
            <dc:creator><![CDATA[Can Aras]]></dc:creator>
            <pubDate>Tue, 19 Jan 2021 16:17:20 GMT</pubDate>
            <atom:updated>2021-01-19T16:23:44.487Z</atom:updated>
            <content:encoded><![CDATA[<h3>React Native, AWS Amplify &amp; AWS AppSync GraphQL API</h3><p>Bu yazıda AWS Amplify ve AWS AppSync üzerinde GraphQL API kullanarak React Native projesinin backend bağlantısını ayarlıyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*PFYe_s4i3j6ze7NvwHMagA.png" /><figcaption><a href="https://aws.amazon.com/tr/blogs/mobile/aws-appsync-offline-reference-architecture/">https://aws.amazon.com/tr/blogs/mobile/aws-appsync-offline-reference-architecture/</a></figcaption></figure><h4><strong>Nedir bu AWS Amplify ?</strong></h4><p>Basitçe web veya mobil projenizin backend ile frontend arasındaki bağlantıyı hızlıca kurmanızı sağlayan AWS’nin oldukça ucuza sunduğu bir hizmettir. Bu hizmetle beraber AWS’nin sunmuş olduğu çoğu hizmeti (AppSync,S3,…) koordineli bir şekilde kullanılması da bu servisin tercih edilmesinin en büyük nedenlerindendir. Aşağıdaki linkten servisin çalışma prensibine, kullanım örneklerine ulaşabilirsiniz.</p><p><a href="https://aws.amazon.com/tr/appsync/">AWS AppSync | Managed GraphQL API&#39;ler | Amazon Web Services</a></p><h4><strong>React Native Projesi</strong></h4><p>Bu kısımda tamamen özgürsünüz, elinizin altında test için oluşturduğunuz projeniz varsa onu kullanabilirsiniz. Ben <a href="https://expo.io/">Expo</a> frameworkünü kullanarak oluşturduğum proje üzerinden anlatımıma devam edeceğim. Aşağıdaki komutları takip ederek Expo üzerinden test ortamı oluşturabilirsiniz.</p><pre>yarn global add expo-cli</pre><pre>expo init testProject</pre><p>Bu aşamadan sonra testProject adını verdiğimiz projemiz varsayılan yapısıyla kurulmuş oluyor.</p><p>Projenin içini süslemek tamamen size kalmış, ben basit bir şekilde resimleri ve ressamları eklediğimiz, çıkardığımız ve listelediğimiz basit bir uygulama yapmayı hedefliyorum.</p><h4><strong>AWS Amplify Kurulumu</strong></h4><blockquote>AWS servislerini çok sık aralıklarla güncelliyor, aşağıdaki işlemleri <a href="https://docs.amplify.aws/start/q/integration/react-native">Amplify Docs</a> üzerinden eş zamanlı olarak kontrol etmek yararlı olabilir.</blockquote><p>Amplify servisini kullanmak için AWS hesabına ihtiyacımız var, bu hesabı ücretsiz bir şekilde oluşturabilirsiniz.</p><p>Hesap açım işlemini tamamladıktan sonra Access Key ID ve Secret Access Key bilgisinin bulunduğu bir tablo bizi karşılayacak. Buradaki anahtarlar daha sonra kullanacağımız için saklamanızda fayda var.</p><p>Kurulumun ilk aşaması amplify-cli nın kurulması.</p><h4><strong>amplify-cli</strong></h4><p>Amplify üzerinde yapacağımız tüm konfigürasyon işlemlerini bu cli üzerinden yapacağız. Kurulumu için sisteminiz de bugün itibariyle minimum ; Node.js v10.x, npm v5.x ve git v2.14.1 olması gerekmekte. Burada cli eklentisini global olarak kurulumunu yapıyoruz, bunun için konsol üzerinde yönetici iznine ihtiyacımız var. Windows kullanıcıları “Node.js command prompt” unu yönetici olarak çalıştırarak, Linux kullanıcıları ise aşağıdaki kodun başına sudo ekleyerek yetkilendirme işlemini yapabilirler.</p><pre>npm install -g @aws-amplify/cli</pre><p>Paketin başarıyla yüklendiğini kontrol etmek için aşağıdaki komutu kullanabilirsiniz.</p><pre>amplify -v</pre><blockquote>Bu aşamada Windows kullanıcıları amplify komutunu göremeyebilirler, nedeni amplify.cmd dosyasının “Windows sistem değişkenleri” ortamında PATH bilgisinin verilmemesinden kaynaklı olabilir.</blockquote><p>Sonra ki aşama ise amplify ın konfigüre edilmesi, aşağıdaki komutla beraber konfigürasyon ekranına geliyoruz;</p><pre>amplify configure</pre><p>Bu komutla beraber tarayıcıda AWS’nin konsol ekranı bizi karşılıyor. Burada daha sonra AWS üzerinden giriş yapmak istediğimiz kullanıcının bilgilerini yönetici yetkisiyle beraber oluşturuyoruz. Daha sonra sistemi kurmak istediğimiz bölgeyi seçiyoruz (Her zaman bize yakın bölgeyi seçmekte fayda var.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*X8rr0YTZ8yQJ34DZ1AqrLw.gif" /><figcaption><a href="https://docs.amplify.aws/images/user-creation.gif">https://docs.amplify.aws/images/user-creation.gif</a></figcaption></figure><p>Bu işlemleri tamamladıktan sonra kontrol ekranımız da AWS üzerinde oluşturduğumuz hesabın Access Key ID ve Secret Access Key bilgisini giriyoruz. Bu işlemle beraber sistemimiz AWS ortamı için hazır hale gelmiş oluyor.</p><h4><strong>Backend Sisteminin Kurulması</strong></h4><p>amplify-cli işlemini başarılı bir şekilde tamamlayıp, kullanıcı bilgilerimizde AWS ortamına kaydettikten sonra sıra projemizi Amplify ortamına tanıtmaya geldi. Bu adımdan sonra ki işlemlerimizi projemizin olduğu dizinde yapacağız.</p><p>Proje dizini altında ;</p><pre>amplify init</pre><p>komutunu çalıştırarak, Amplify sistemi için gerekli olan bilgileri girerek projemizi tanıtıyoruz. Test projemiz için gerekli olan bilgiler :</p><pre>? Enter a name for the project: testProject<br>? Enter a name for the environment: demo-testProject<br>? Choose your default editor: VSCode<br>? Choose the type of app that you&#39;re building: javascript <br>? What javascript framework are you using: react-native <br>? Source Directory Path:  ./src <br>? Distribution Directory Path: ./src <br>? Build Command:  npm run-script build <br>? Start Command: npm run-script start <br>? Do you want to use an AWS profile? Y <br>? Please choose the profile you want to use: &lt; demo-testProject &gt;</pre><blockquote>Directory Path kısımlarını oluşturduğunuz projenin dosyalama sistemine göre verebilirsiniz.</blockquote><p>Bu işlemle beraber proje dizinimiz de amplify dosyasının oluştuğundan emin oluyoruz. Bu adımdan sonra işlemlerimizi Amplify Dashboard üzerinden sürdürebiliriz. Dashboard sayfasına; AWS konsol sayfasından AWS Amplify servisini seçerek ulaşabilirsiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bK6S-5APJ9zjjltQm38V7w.png" /><figcaption>Amplify Dashboard</figcaption></figure><h4><strong>Data Modelling</strong></h4><p>GraphQL API nın kurulumuna geçmeden önce örnek olması için basit bir veri modeli oluşturalım. Admin UI üzerinden Data sekmesini seçerek istediğiniz şekilde veri modeli oluşturabilirsiniz. Düzenlemeyi tamamladıktan sonra projemizi güncellemek için proje dizininde aşağıdaki komutu kullanıyoruz.</p><pre>amplify pull</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W75AEvGDTs1EHqGknLUt6Q.png" /><figcaption>Data Modelling</figcaption></figure><h4><strong>GraphQL API</strong></h4><p>Veri modelimizi de oluşturduktan sonra GraphQL API nı oluşturmaya geçebiliriz. Aşağıdaki komutu proje dizininde çalıştırıyoruz.</p><pre>amplify add api</pre><p>Bu komutla beraber konsol ekranında eklemek istediğimiz API nin bilgilerini ve gerekli konfigürasyon ayarlarını yapıyoruz. Test uygulaması için aşağıdaki değerleri kullandım, projenize göre burada gerekli ayarlamaları yapabilirsiniz.</p><pre>? Please select from one of the below mentioned services: # GraphQL ? Provide API name: # test-api<br>? Choose the default authorization type for the API: # API Key <br>? Enter a description for the API key: # demo-api <br>? After how many days from now the API key should expire: # 365<br>? Do you want to configure advanced settings for the GraphQL API: # No <br>? Do you have an annotated GraphQL schema? # No <br>? Do you want a guided schema creation? # Yes <br>? What best describes your project: # Test Project<br>? Do you want to edit the schema now? # Yes</pre><p>İşlemi tamamladıktan sonra proje dizinimizde aşağıdaki dizinde schema.graphql dosyasını görebiliriz.</p><pre>amplify/backend/api/test-api/schema.graphql</pre><p>Schema içerisinde, oluşturulan tablolara ait bilgiler aşağıdaki gibi olmalı.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h_oB62zfCGAc3aZGRn4glw.png" /><figcaption>schema.graphql</figcaption></figure><p>Schema.graphql dosyanını kontrol ettikten sonra AWS üzerinde projemizi güncelleyebiliriz, bunun için projemizi pushluyoruz.</p><pre>amplify push</pre><p>Push işlemiyle beraber yarattığımız schema ya bağlı olarak API miz üzerinde değişiklikler yapabilir, graphql tarafından üretilen mutation, query ve subscription operasyonlarına ait dosyaları istediğimizi belirtebiliriz.</p><pre>? Do you want to generate code for your newly created GraphQL API? Y ? Choose the code generation language target: javascript <br>? Enter the file name pattern of graphql queries, mutations and subscriptions src/graphql/**/*.js <br>? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions? Y <br>? Enter maximum statement depth [increase from default if your schema is deeply nested]: 2</pre><h4><strong>GraphQL API Kontrolü</strong></h4><p>AWS, GraphQL bağlantısını kendi servisi olan AWS AppSync üzerinden sağlıyor. Bunun da bize en büyük artısı AppSync konsolu üzerinden yaptığımız tüm işlemleri görebilir, üzerinde değişiklikler yapabiliriz.</p><p>Oluşturduğumuz GraphQL bağlantısını kontrol etmek için AppSync konsoluna gelerek Queries seçeneğini seçiyoruz. Burada ki playground alanını kullanarak test verisi oluşturabiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YbAy5KJz3fY8Elk5MMUHTQ.png" /><figcaption>Test Data</figcaption></figure><h4><strong>Proje Üzerinde GraphQL API Kullanımı</strong></h4><p>GraphQL API bağlantısını kullanabilmemiz için @aws-amplify/api modülüne ihtiyacımız var.</p><pre>yarn add @aws-amplify/api</pre><p>Proje içerisinde @aws-amplify/api modülünü ekleyerek konfigürasyon dosyamızı (aws-exports.js) veriyoruz. Bu dosya projemize Amplify kurulumu yaparken otomatik yaratılmış olması gerekmekte.</p><p>Yukarıda konsol üzerinden oluşturduğumuz test verisini oluşturmak için aşağıdaki koda benzer bir yapı kullanabiliriz.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/65dd5ef91b83f5d830da893d3508ff91/href">https://medium.com/media/65dd5ef91b83f5d830da893d3508ff91/href</a></iframe><h4><strong>GraphQL API Güncellemesi</strong></h4><p>Projemize ilk veri modelini oluşturarak başlamıştık. Daha sonrasında GraphQL API bağlantısını sağlayarak var olan veri modelleri arasında oluşturulabilecek olan queryleri ve mutationları hazır olarak almıştık. Peki daha sonra yapılacak olan eklemeleri ve çıkarma işlemlerinde bu dosyaların güncellenmesini nasıl sağlayabiliriz ? Burada amplify codegen yapısı devreye giriyor. Projenize eklemek için;</p><pre>amplify add codegen — apiId XXXXXXXXXX<br>amplify codegen</pre><p>veya proje dizininde;</p><pre>amplify add codegen<br>amplify codegen</pre><p>komutlarını çalıştırabilirsiniz.</p><h4><strong>Kapanış</strong></h4><p>Buraya kadar hatasız bir şekilde geldiyseniz, elinizde backendi neredeyse hazır bir proje olmuş olacak. Üstelik bu yapıyı kurarken neredeyse hiç kod yazmadık, sadece AWS üzerinde kendimizi ve projemizi tanıttık. Buradan sonra ki aşamada ise tamamen size kalmış, AWS Amplify üzerinden; analytics modulünü kurabilir, authentication servisini kullanabilirsiniz.</p><p>Sevgiler,</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b10c7df5ba7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>