<?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 karatasebu on Medium]]></title>
        <description><![CDATA[Stories by karatasebu on Medium]]></description>
        <link>https://medium.com/@karatasebu?source=rss-72387725c22f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xhDuSz9EHekKdT2r8LlH2w.jpeg</url>
            <title>Stories by karatasebu on Medium</title>
            <link>https://medium.com/@karatasebu?source=rss-72387725c22f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:42:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@karatasebu/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[Micro-Frontends with React&Vue]]></title>
            <link>https://karatasebu.medium.com/micro-frontends-with-react-vue-50ea9c4bc5a2?source=rss-72387725c22f------2</link>
            <guid isPermaLink="false">https://medium.com/p/50ea9c4bc5a2</guid>
            <category><![CDATA[micro-frontends]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[karatasebu]]></dc:creator>
            <pubDate>Sat, 04 Dec 2021 15:46:35 GMT</pubDate>
            <atom:updated>2021-12-08T07:29:38.379Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we are making a trip to future of the web applications. I will try to explain what are micro-frontends, how we can use React and Vue in same project with a simple example.</p><p>Firstly I want to mention what are micro-frontends. Micro-frontends are basically brings microservices concept to frontend world. Oh sorry, before that I should have to explain microservices I think. Microservices are an architectural approach in which a single application is composed of many independently deployable smaller components, or services. Each component has their own tech stack and communicate each other. With this approach application update so easily, you dont have to update all application for one feature, teams can use different tech stacks, components can scale independently. Think you have same power in the frontend. You can use Vue, React, Svelte at the same time. Your component’s scale indepently and you don’t have update all application for changes in your component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*WHOyAn07kFX9hPlaXUKAkw.png" /><figcaption>Monolith frontend and microservices</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*GnqQQE_DtExo44OeL_QNKA.png" /><figcaption>Micro-fronteds and microservices</figcaption></figure><p>Ok, we understand the main purpose. Let’s use Webpack Module Federation to create our micro-frontends with very simple example. I’m going to use create-mf-app cli to create Module Federation applications. My project have one component for Header with React and one component for Content with Vue. Firstly I’m creating Vue project (follow <a href="https://github.com/karatasebu/microfrontend-example"><strong><em>here</em></strong></a> to understand better);</p><pre>npx create-mf-app</pre><p>I’m giving “content” name for project, choosing Application, giving port 3000, choosing Vue 3, JavaScript, CSS. I’m watching same order for “header”. But this time I’m choosing react for framework and 3001 for port. Now I have two separate project. How can i connect the two? Before coming this topic I want to make some changes in projetcs.</p><p>I’m opening React project and creating file bootstrap.js and it’s content like below. Bootstrap’s main purposes are; initialise the application, sharing the application’s configurations to all the micro-frontends, load/unload a micro-frontend based on the user’s state, routing between micro-frontends<br>,exposing an API for interacting between a micro-frontend and the client-side orchestrator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*UTRYQhUeGxGZ_foWIs-xgw.png" /></figure><p>in index.js just importing bootstrap file, we are doing this for asynchronous installation, so we can make sure that app is ready;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*i2raaVw8flXf-DgemP9eRA.png" /></figure><p>I changed App.jsx and index.css but it’s not relevant with micro-frontend. I don’t touch the index.html and I will do the same for Vue project yo can look all changes from <a href="https://github.com/karatasebu/microfrontend-example"><strong><em>here</em></strong></a>.</p><p>Now we came the most important part, using React project in Vue project. For that I’m opening my React project’s webpack.config.js. There is a ModuleFederationPlugin part is related to micro-frontends, I’m just writing “./App”: “./src/App” in <strong>exposes</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*erNO-_Id3z5MXS9iGO_ycw.png" /></figure><p>It’s just like an exporting. This allows me to use in other project. If we are thinking this way I also must import it to use. For this I’m opening Vue project’s webpack.config.js and writing header: “header@http://localhost:3001/remoteEntry.js&quot; to <strong>remotes</strong> section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*MtLR_N7ioT8FV48-3YEUzQ.png" /></figure><p>To use React component in Vue, I have to install React;</p><pre>pnpm i react react-dom</pre><p>and also for both project when I’m on project’s own directory;</p><pre>pnpm i</pre><p>Now, one last step left to importing React component in Vue and render. I’m creating div with ref root;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*juT99umoUFB_2yoZDhoZ-w.png" /></figure><p>and render the component in root;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*LAKgSuu2yFUm2RmN4GOUzQ.png" /></figure><p>Now you can run firstly React project and then Vue project with;</p><pre>pnpm start</pre><p>That’s it you have very basic app with using micro-frontends architecture. That’s all for today, see you in next articles.</p><ul><li><a href="https://medium.com/trendyol-tech/micro-frontend-architecture-with-webpack-module-federation-part-1-9827d436bd1e">Micro Frontends Architecture with Webpack Module Federation (Part 1)</a></li><li><a href="https://medium.com/dazn-tech/orchestrating-micro-frontends-a5d2674cbf33">Orchestrating micro-frontends</a></li><li><a href="https://micro-frontends.org/">Micro Frontends</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50ea9c4bc5a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Higher Order Function and Callback in Javascript]]></title>
            <link>https://karatasebu.medium.com/higher-order-function-and-callback-in-javascript-fe9bc19e858a?source=rss-72387725c22f------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe9bc19e858a</guid>
            <category><![CDATA[higher-order-function]]></category>
            <category><![CDATA[callback]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[karatasebu]]></dc:creator>
            <pubDate>Thu, 25 Nov 2021 19:30:01 GMT</pubDate>
            <atom:updated>2021-11-27T15:22:29.083Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to the JavaScript’s fancy functional programming world. In this article I will try to explain what are higher order function and callback and how we can use them.</p><p>If you have been programming in JavaScript for a while, you may have already used them without even knowing. Before coming to main topic I just want to mention what is first-class function. In JavaScript functions are first-class functions. This means that functions are just like other variables<strong> </strong>(string, number, object). <strong>They can be stored as variables, used in arrays, assigned to objects, passed as a argument and returned from another functions</strong>.</p><p>Now we can understand higher order function and callback better. Higher order function is<strong> a function that receives a function as an argument or returns the function as output</strong>. (filter, reduce, map) are some of the built-in higher order functions in JavaScript. They can take callbacks as argument. Oh wait. What I just said? Callbacks? Yes, you are right, callback is <strong>a function passed as an argument to another function. </strong>Ok, I know you don’t understand 100%. Let’s jump into example, learn how we should use and make it more clearer.</p><p>Imagine we have a function and it’s task is to take an array as argument and multiply by 2 like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*Xp3qggkngLu0d8T8X7hGlQ.png" /></figure><p>We have another function to divide. Let’s define new function called divideBy2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*Vgu5w9yEX8uQzjmMT9tgjA.png" /></figure><p>But what if we want to change some functionality, in this case we have to apply changes to both functions. Think there is more functions and more complicated functions, this would be so hard. But what would happen if we used higher order function and callback.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*dJPMdr_T6diyPZXnHi9vlA.png" /></figure><p>manipulate function is higher order function and operate function is callback. Now we have more readable and maintainable code. That’s all for this article, see you in others.</p><p>Happy coding.</p><p><a href="https://frontendmasters.com/courses/javascript-hard-parts-v2/">Learning the Hard Parts of JS</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe9bc19e858a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nunjucks with Gulp]]></title>
            <link>https://karatasebu.medium.com/nunjucks-with-gulp-be05c1ca7f4f?source=rss-72387725c22f------2</link>
            <guid isPermaLink="false">https://medium.com/p/be05c1ca7f4f</guid>
            <category><![CDATA[template-engine]]></category>
            <category><![CDATA[gulp]]></category>
            <category><![CDATA[nunjucks]]></category>
            <dc:creator><![CDATA[karatasebu]]></dc:creator>
            <pubDate>Fri, 11 Jun 2021 15:49:06 GMT</pubDate>
            <atom:updated>2021-06-12T05:58:04.886Z</atom:updated>
            <content:encoded><![CDATA[<p>Day by day front-end development becomes more complex. In old times you were creating .html file and “ta ta” you had a web page but nowadays there are tones of other tools (HTML template engines, CSS pre-precossers, frameworks, Typescript, etc.). But there is one problem, our browsers don’t understand what are these tools and languages saying. We need a translator to negotiate browsers and our codes. Therefore other tools (webpack, gulp, parcel etc.) are created. I can hear your sayings “what is this madness tools for tools”. But we have to admit that today’s webpages are more complex and bigger. Because of that we must learn these technologies. In this article I will try to explain how we can use one of template engines (Nunjucks) with task runner (Gulp). Let’s dive into it.</p><p>Firstly, we are gonna create folder and open it on editor. We need to initialize npm. I am using “-y” to use default values, you can enter values for each. For this;</p><pre>npm init -y</pre><p>If you will use Gulp first time, you need to install the Gulp command line utility;</p><pre>npm install --global gulp-cli</pre><p>Now we can use gulp commands. But still we haven’t installed packages we are gonna use. For installing Gulp, Nunjucks-render and Browser-sync (to see directly what changes we did);</p><pre>npm install --save-dev gulp gulp-nunjucks-render browser-sync</pre><p>We installed packages, now we can think what is going on with njk files. Writing code in njk file is so similar to HTML but there are no syntax highlighting and emmet, this is so annoying and time waster. Because of that I am using extension. When you write nunjucks in VS Code extensions you will see a lot of extensions. I recommend you to install second one, named “Nunjucks Template”. We installed extension but still we can’t use emmet. For this problem, VS Code settings &gt; emmet include, click the add item button, type “njk” to item section and “html” to value section and click ok.</p><p>We made our prepation. Now let’s imagine we have home page like below. You can see components and file names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNCC0DQbs8Ch_eXExlFQsw.png" /></figure><p>I am creating views folder for my nunjucks files and gulpfile.js for gulp tasks. I am sharing my folder display, so you can visualize in your mind and when we come to gulpfile.js you can create your own paths.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*7-iq57EMNjOpYm2sGnoTjw.png" /></figure><p>Now we can create our components step by step. base.njk for every page’s base, header.njk for header(shared component) and home.njk for content. This is just a small example, you can think in big projects there will be more components.</p><p>Template inheritance is a way to make it easy to reuse templates. You leverage inheritance with the extends and block tags. You can find more detailed information here <a href="https://jinja.palletsprojects.com/en/3.0.x/templates/#template-inheritance"><strong>jinja2 docs</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*ExPKn6nfGhknPHEsYNp5sw.png" /></figure><p>And the last component to import all other components to one index.njk;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*SPy3YCztCOxN0fzepROsHg.png" /></figure><p>We created our project, one last step left. Compile and see changes live with Gulp. Now we are going jump into gulpfile.js. As you can see below, there are two tasks “html” and “watch”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*jVz126uWNxYorBItjGmzkA.png" /></figure><p>“html” to compile our njk files to HTML;</p><pre>gulp html</pre><p>“watch” to watch our files and if there is a change, apply change to browser directly;</p><pre>gulp watch</pre><p>That’s it. You are ready to create your own projects with nunjucks and gulp.</p><p>Thank you so much for reading this far. This is my first article because of that there could be mistakes that I missed . Please don’t hesitate to share any feedback. <a href="https://www.linkedin.com/in/ebubekirkaratas/"><strong>My Linkedin</strong></a></p><ol><li><a href="https://mozilla.github.io/nunjucks/">https://mozilla.github.io/nunjucks/</a></li><li><a href="https://gulpjs.com/docs/en/getting-started/quick-start">https://gulpjs.com/docs/en/getting-started/quick-start</a></li><li><a href="https://www.npmjs.com/package/gulp-nunjucks-render">https://www.npmjs.com/package/gulp-nunjucks-render</a></li><li><a href="https://zellwk.com/blog/nunjucks-with-gulp/">https://zellwk.com/blog/nunjucks-with-gulp/</a></li><li><a href="https://www.youtube.com/watch?v=LYbt50dhTko&amp;t=503s">https://www.youtube.com/watch?v=STxO9XQJ_lg&amp;t=1s</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be05c1ca7f4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>