<?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 Erkut Cakmak on Medium]]></title>
        <description><![CDATA[Stories by Erkut Cakmak on Medium]]></description>
        <link>https://medium.com/@cakmak.erkut1?source=rss-943023fbec8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*DVHM8d1g3QnFx0Cf</url>
            <title>Stories by Erkut Cakmak on Medium</title>
            <link>https://medium.com/@cakmak.erkut1?source=rss-943023fbec8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:09:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cakmak.erkut1/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[CSS Flexbox: A Comprehensive Guide]]></title>
            <link>https://medium.com/@cakmak.erkut1/flexbox-a-comprehensive-guide-5a77c2d1eba2?source=rss-943023fbec8------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a77c2d1eba2</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[user-interface]]></category>
            <category><![CDATA[flexbox]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Erkut Cakmak]]></dc:creator>
            <pubDate>Wed, 24 May 2023 17:28:05 GMT</pubDate>
            <atom:updated>2023-05-24T18:32:51.928Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MN63lf3-96i9DzOrE-2utg.png" /></figure><p>In the world of modern web development, Flexbox has become an invaluable tool for creating flexible and responsive layouts. With its intuitive approach to building dynamic designs, mastering Flexbox is essential for any front-end developer. In this article, we will explore the fundamentals of CSS Flexbox, discuss its key concepts, and provide practical code examples to help you harness its full potential.</p><p><strong>What is Flexbox?</strong></p><p>Flexbox is a layout module that offers a flexible way to arrange and align elements within a container. Unlike traditional layout methods, which rely on floats and positioning, Flexbox provides a simplified approach for creating complex layouts with ease. By leveraging flexible box model properties, developers can achieve responsive designs that adapt to different screen sizes and orientations.</p><p><strong>Let’s start using it!</strong></p><p>To begin using Flexbox, we need to designate a container element as a flex container. We can set the class name of the element as “container” and start by applying the display: flex property to this container, as we activate the Flexbox behavior. This allows us to control the alignment and positioning of the flex items inside.</p><pre>.container {<br>  display: flex;<br>}</pre><p><strong>Sub-Containers</strong></p><p>Flex items are the child elements within the flex container. These items are laid out along a flex container’s main axis and can be arranged horizontally or vertically. Each flex item can have its own unique properties, such as size, order, and alignment. By default, flex items will stretch to fill the available space within the container. We can set the properties of parent container as well as children containers however we like.</p><pre>&lt;div className=&quot;container&quot;&gt;<br>  &lt;div className=&quot;item&quot;&gt;Item 1&lt;/div&gt;<br>  &lt;div className=&quot;item&quot;&gt;Item 2&lt;/div&gt;<br>  &lt;div className=&quot;item&quot;&gt;Item 3&lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>Flexbox Properties</strong></p><p>CSS Flexbox provides several properties that allow precise control over the layout and appearance of flex items. Here are some essential properties we should know:</p><p>flex-direction: Defines the direction of the main axis, determining whether items 1, 2, and 3 are laid out horizontally or vertically.</p><pre>.container {<br>  flex-direction: row; /* horizontal layout */<br>}</pre><pre>.container {<br>  flex-direction: column; /* vertical layout */<br>}</pre><p>flex-wrap: Specifies whether flex items 1, 2, and 3 should wrap to multiple lines or stay on a single line when the browser shrinks.</p><pre>.container {<br>  flex-wrap: nowrap; /* single line */<br>}</pre><pre>.container {<br>  flex-wrap: wrap; /* multiple lines */<br>}</pre><p>justify-content: Determines how flex items 1, 2, and 3 are distributed along the <strong>main axis</strong>.</p><pre>.container {<br>  justify-content: flex-start; /* items start at the beginning */<br>  justify-content: flex-end; /* items end at the end */<br>  justify-content: center; /* items are centered */<br>  justify-content: space-between; /* items are evenly distributed with equal spacing */<br>  justify-content: space-around; /* items are evenly distributed with equal spacing around them */<br>}</pre><p>align-items: Controls the alignment of flex items 1, 2, and 3 along the <strong>cross axis</strong>.</p><pre>.container {<br>  align-items: stretch; /* items stretch to fill the container height */<br>  align-items: flex-start; /* items are aligned at the start */<br>  align-items: flex-end; /* items are aligned at the end */<br>  align-items: center; /* items are centered */<br>  align-items: baseline; /* items are aligned based on their baselines */<br>}</pre><p>align-self: Overrides the default alignment for an individual flex item.</p><pre>.item {<br>  align-self: flex-start; /* aligns this item at the start */<br>}</pre><p>flex: Sets the flex-grow, flex-shrink, and flex-basis properties of a flex item in one declaration.</p><pre>.item {<br>  flex: 1; /* flex-grow: 1, flex-shrink: 1, flex-basis: 0% */<br>  flex: 2; /* this item will grow twice as much as others */<br>  flex: 0 0 200px; /* fixed size of 200px */<br>}</pre><p><strong>Responsive Designs with Flexbox</strong></p><p>Flexbox is great at creating responsive layouts effortlessly. By combining media queries with Flexbox properties, we can adapt the layout based on different viewport sizes. This flexibility allows our designs to easily adjust to various devices, providing optimal user experiences.</p><pre>@media screen and (max-width: 600px) {<br>  .container {<br>    flex-direction: column; /* switch to vertical layout on smaller screens */<br>  }<br>}</pre><p><strong>Flexbox Use Cases</strong></p><ul><li>Creating navigation menus with flexible items that adjust to different screen sizes.</li></ul><pre>.nav {<br>  display: flex;<br>  justify-content: space-between;<br>}</pre><ul><li>Designing equal height columns, irrespective of the content inside.</li></ul><pre>.container {<br>  display: flex;<br>}<br><br>.column {<br>  flex: 1;<br>}</pre><ul><li>Building flexible grids that adapt to varying content sizes and maintain consistent spacing.</li></ul><pre>.container {<br>  display: flex;<br>  flex-wrap: wrap;<br>  justify-content: space-between;<br>}<br><br>.item {<br>  flex-basis: calc(33.33% - 20px);<br>  /* adjust flex-basis to desired grid item width */<br>}</pre><ul><li>Aligning items both vertically and horizontally within a container.</li></ul><pre>.container {<br>  display: flex;<br>  align-items: center;<br>  justify-content: center;<br>}</pre><p><strong>Conclusion</strong></p><p>CSS Flexbox revolutionizes the way we create layouts by providing a flexible and intuitive approach. By understanding the fundamental concepts and utilizing the wide range of Flexbox properties, you can achieve complex layouts with minimal effort. With the code examples provided, you can dive into the world of Flexbox and unlock its potential to create visually appealing and adaptive user interfaces. Embrace the power of Flexbox and elevate your web development skills to new heights!</p><p><strong><em>References:</em></strong></p><ul><li><a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">A Complete Guide to CSS Flexbox | CSS-Tricks</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox">Flexbox - Learn web development | MDN</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a77c2d1eba2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CRUD Operations in Flask with RESTful]]></title>
            <link>https://medium.com/@cakmak.erkut1/crud-operations-in-flask-with-restful-9de3148f32de?source=rss-943023fbec8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9de3148f32de</guid>
            <category><![CDATA[restful-api]]></category>
            <category><![CDATA[crud]]></category>
            <category><![CDATA[flask-restful]]></category>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Erkut Cakmak]]></dc:creator>
            <pubDate>Mon, 08 May 2023 12:04:15 GMT</pubDate>
            <atom:updated>2023-05-08T12:04:15.379Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*Yb2ueMmE-x-MGiWW_F4vGw.png" /></figure><p>Flask is a popular Python web framework that allows developers to create web applications quickly and easily. In this article, we’ll look at how to implement GET, POST, PATCH, and DELETE methods in Flask using RESTful APIs.</p><h4>What are RESTful APIs?</h4><p>REST stands for Representational State Transfer, which is an architectural style for designing web services that are simple, lightweight, and scalable. RESTful APIs are based on HTTP, which makes it easy to implement them in different programming languages.</p><h4>What are CRUD operations?</h4><p>GET, POST, PATCH, and DELETE are HTTP methods that are used to interact with RESTful APIs. These methods correspond to the CRUD (Create, Read, Update, Delete) operations that are commonly used in web applications.</p><p><strong>GET:</strong> <em>This method is used to retrieve data from a server. It is a read-only operation that does not modify the data on the server.</em></p><p><strong>POST: </strong><em>This method is used to create new data on the server. It is a write operation that adds new data to the server.</em></p><p><strong>PATCH: </strong><em>This method is used to update existing data on the server. It is a write operation that modifies existing data on the server.</em></p><p><strong>DELETE:</strong> <em>This method is used to delete data from the server. It is a write operation that removes data from the server.</em></p><h4>Implementing GET, POST, PATCH, and DELETE methods in Flask</h4><p>Flask is a lightweight Python web framework that makes it easy to build web applications quickly. To implement GET, POST, PATCH, and DELETE methods in Flask, we’ll be using Flask-RESTful. Flask-RESTful is an extension for Flask that makes it easy to build RESTful APIs.</p><p>To get started with Flask-RESTful, we’ll need to install it using pip:</p><pre>pip install flask-restful</pre><p>Next, let’s create a simple Flask application in our “app.py” file which will serve as our API with a class of Users. Let’s pretend that we have a “User” model in our “models.py” file and implement the CRUD operations in our “Users” class that corresponds to that model.</p><pre>from flask import Flask, request, make_response<br>from flask_restful import Api, Resource<br>from config import app, db, api<br>from models import User<br><br>app = Flask(__name__)<br>db.init_app(app)<br>api = Api(app)<br><br>class Users(Resource):<br>    def get(self):<br>        pass<br><br>    def post(self):<br>        pass<br><br>    def patch(self):<br>        pass<br><br>    def delete(self):<br>        pass<br><br>api.add_resource(User, &#39;/user&#39;)<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(port=5555, debug=True)</pre><h4>GET</h4><p>Let’s start with the GET method. First, we are declaring a variable and setting it equal to a list comprehension that queries the User model in our models.py file. This list comprehension will bring all the users in our User model, however, notice that in the beginning of our list comprehension we have a “to_dict()” method which converts the data we receive from User model to a dictionary. Lastly, we return a “make_response” function which we pass in the variable we created and the appropriate HTTP response status code.</p><pre>from flask import Flask, request, make_response<br>from flask_restful import Api, Resource<br>from config import app, db, api<br>from models import User<br><br>app = Flask(__name__)<br>db.init_app(app)<br>api = Api(app)<br><br>class Users(Resource):<br>    def get(self):<br>        users_dict = [user.to_dict() for user in User.query.all()]<br>        return make_response(users_dict, 200)<br><br>    def post(self):<br>        pass<br><br>    def patch(self):<br>        pass<br><br>    def delete(self):<br>        pass<br><br>api.add_resource(Users, &#39;/users&#39;)<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(port=5555, debug=True)</pre><h4>POST</h4><p>Next, is our POST method. Here, first thing we need to do is to set our variable “data” to “request.get_json()” function which parses the incoming JSON request data and returns it. Next, we set up our new user instance and specify the User model, then we can write down which key value pairs we are targeting with our method, along with the “data” variable which helps us “jsonify” our request. Lastly, using session methods we add our user to the database and commit it, following by a return statement similar to the one in our GET method. Do not forget to convert your new user variable to a dictionary!</p><pre>from flask import Flask, request, make_response<br>from flask_restful import Api, Resource<br>from config import app, db, api<br>from models import User<br><br>app = Flask(__name__)<br>db.init_app(app)<br>api = Api(app)<br><br>class Users(Resource):<br>    def get(self):<br>        users_dict = [user.to_dict() for user in User.query.all()]<br>        return make_response(users_dict, 200)<br><br>    def post(self):<br>        data = request.get_json()<br>        new_user = User(<br>                 name = data[&quot;name&quot;],<br>                 address = data[&quot;address&quot;],<br>                 email = data[&quot;email&quot;]<br>              )<br>        db.session.add(new_user)<br>        db.session.commit()<br><br>        return make_response(new_user.to_dict(), 201)<br><br>    def patch(self):<br>        pass<br><br>    def delete(self):<br>        pass<br><br>api.add_resource(Users, &#39;/users&#39;)<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(port=5555, debug=True)</pre><h4>PATCH</h4><p>Next, let’s set up our PATCH method. Notice we have a different class named “UserById” because we want to update a specific user among users, therefore, we call the user that we want to update with its specific id. We should also pass in “id” parameter inside of our patch function. As we have done in the previous method, we declare our “data” variable first, then, we grab the user that we want by querying our database using “filter_by” method which will bring the user that has the same id that was passed in. Next, we make our for loop with the “attr” we want to change and we set up our method by using “setattr” which sets the attribute of the object that we grabbed by its id. Setattr method takes in: the user variable that we created, the attr that we are targeting and itirating through, and data. Lastly, as we did before, we add the updated user to our database and commit it, and return a make response function with the user variable converted to a dictionary along with the appropriate HTTP response status code.</p><pre>from flask import Flask, request, make_response<br>from flask_restful import Api, Resource<br>from config import app, db, api<br>from models import User<br><br>app = Flask(__name__)<br>db.init_app(app)<br>api = Api(app)<br><br>class UserById(Resource):<br>    def patch(self, id):<br>        data = request.get_json()<br>        user = User.query.filter_by(id=id).first()<br>        <br>        for attr in data:<br>          setattr(user, attr, data[attr])<br>        <br>        db.session.add(user)<br>        db.session.commit()<br><br>        return make_response(user.to_dict(), 202)<br><br>    def delete(self, id):<br>        pass<br><br>api.add_resource(Users, &#39;/users&#39;)<br>api.add_resource(UserById, &#39;/user/&lt;int:id&gt;&#39;)<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(port=5555, debug=True)</pre><h4>DELETE</h4><p>Our last method is DELETE. This one is pretty straight forward. We simply grab the user that we want to delete by its id just like we did in the PATCH method, then, instead of adding it to our database, we delete it with “db.session.delete” and commit it. Lastly, return the make response function with an empty string (or you can include information in strings) and the appropriate HTTP response status code.</p><pre>from flask import Flask, request, make_response<br>from flask_restful import Api, Resource<br>from config import app, db, api<br>from models import User<br><br>app = Flask(__name__)<br>db.init_app(app)<br>api = Api(app)<br><br>class UserById(Resource):<br>    def patch(self, id):<br>        data = request.get_json()<br>        user = User.query.filter_by(id=id).first()<br>        <br>        for attr in data:<br>          setattr(user, attr, data[attr])<br>        <br>        db.session.add(user)<br>        db.session.commit()<br><br>        return make_response(user.to_dict(), 202)<br><br>    def delete(self, id):<br>        user = User.query.filter_by(id=id).first()<br><br>        db.session.delete(user)<br>        db.session.commit()<br><br>        return make_response(&#39;&#39;, 204)<br><br>api.add_resource(Users, &#39;/users&#39;)<br>api.add_resource(UserById, &#39;/user/&lt;int:id&gt;&#39;)<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(port=5555, debug=True)</pre><h4>Conclusion</h4><p>In conclusion, Flask-RESTful is a powerful extension for Flask that makes it easy to implement RESTful APIs. GET, POST, PATCH, and DELETE methods are essential for creating CRUD operations in a web application. By using Flask-RESTful, we can create a robust API that can handle different types of requests and provide appropriate responses. Flask’s simplicity, coupled with Flask-RESTful, makes it an ideal framework for building RESTful APIs.</p><p><a href="https://restfulapi.net/">What is REST?: REST API Tutorial</a></p><p><a href="https://flask-restful.readthedocs.io/en/latest/">https://flask-restful.readthedocs.io</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9de3148f32de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic CRUD Operations in SQL]]></title>
            <link>https://medium.com/@cakmak.erkut1/basic-crud-operations-in-sql-38931234c5e8?source=rss-943023fbec8------2</link>
            <guid isPermaLink="false">https://medium.com/p/38931234c5e8</guid>
            <category><![CDATA[crud]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[sqlite]]></category>
            <dc:creator><![CDATA[Erkut Cakmak]]></dc:creator>
            <pubDate>Mon, 17 Apr 2023 12:12:01 GMT</pubDate>
            <atom:updated>2023-04-17T12:12:01.067Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*0liZynQyjqRf8VjEaGWsNw.jpeg" /></figure><p>SQL (Structured Query Language) is a popular language used to interact with databases, and it provides various commands for CRUD operations.</p><p>CRUD operations are the backbone of any database system. These operations are the basic building blocks for any database application, and they allow developers to perform various tasks such as creating new records, reading existing data, updating records, and deleting records from tables. Understanding these operations is crucial for working with databases and building applications that rely on them.</p><p>In this article, we will explore the CRUD operations in SQL and how they are used in database applications.</p><h3>CREATE</h3><p>The first operation in CRUD is ‘Create’. It is used to add new records to a table in a database. To create a new record in SQL, we use the ‘INSERT’ statement. The syntax for the INSERT statement is:</p><pre>INSERT INTO table_name (column1, column2, column3)<br>VALUES (value1, value2, value3);</pre><p>In this statement, we specify the name of the table and the values that we want to insert into the columns of the table. We can add data to one or more columns by specifying the corresponding values.</p><p>Let’s say that our table “customers” have columns “id”, “name”, and “email”. To insert a new customer record, we would use the following statement:</p><pre>INSERT INTO customers (id, name, email)<br>VALUES (1, &#39;John Doe&#39;, &#39;johndoe@example.com&#39;);</pre><h3>READ</h3><p>The ‘Read’ operation is used to retrieve data from a database. In SQL, the ‘SELECT’ statement is used to retrieve data from one or more tables. The syntax for the SELECT statement is as follows:</p><pre>SELECT column1, column2, column3<br>FROM table_name<br>WHERE condition;</pre><p>In this statement, we specify the name of the columns we want to retrieve from the table and the name of the table itself. We can also use the ‘*’ operator to select all columns from a table. The ‘WHERE’ clause is used to specify conditions that must be met for the data to be retrieved.</p><p>For example, to retrieve all the records from the ‘customers’ table, we would use the following statement:</p><pre>SELECT * FROM customers;</pre><h3>UPDATE</h3><p>The ‘Update’ operation is used to modify existing records in a database. In SQL, the ‘UPDATE’ statement is used to change the values of one or more columns in a table. The syntax for the UPDATE statement is as follows:</p><pre>UPDATE table_name<br>SET column1 = value1, column2 = value2, column3 = value3<br>WHERE condition;</pre><p>In this statement, we specify the name of the table we want to update, the new values we want to set for each column, and the condition that identifies the records we want to update.</p><p>Suppose we want to update the email address of a customer with ID ‘1’ in the ‘customers’ table. We would use the following statement:</p><pre>UPDATE customers<br>SET email = &#39;johndoenew@example.com&#39;<br>WHERE id = 1;</pre><h3>DELETE</h3><p>The ‘Delete’ operation is used to remove records from a database. In SQL, the ‘DELETE’ statement is used to remove one or more records from a table. The syntax for the DELETE statement is as follows:</p><pre>DELETE FROM table_name<br>WHERE condition;</pre><p>In this statement, we specify the name of the table we want to delete records from and the condition that identifies the records we want to remove.</p><p>Suppose we want to delete a customer with ID ‘2’ from the ‘customers’ table. We would use the following statement:</p><pre>DELETE FROM customers<br>WHERE id = 2;</pre><h3>Conclusion</h3><p>In conclusion, CRUD operations are fundamental to working with relational databases and are widely used in SQL. By understanding these operations, we can effectively manage data and build applications that rely on databases. Whether it is creating new records, retrieving existing data, updating records, or deleting records, these operations play a crucial role in database management.</p><p><em>Useful References</em></p><ul><li><a href="https://www.w3schools.com/sql/sql_intro.asp"><em>https://www.w3schools.com/sql/sql_intro.asp</em></a></li><li><a href="https://www.sqlshack.com/sql-crud-operations-cheat-sheet/"><em>https://www.sqlshack.com/sql-crud-operations-cheat-sheet/</em></a></li><li><a href="https://www.codecademy.com/articles/sql-crud"><em>https://www.codecademy.com/articles/sql-crud</em></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38931234c5e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick Guide to Client-Side Routing with React Router]]></title>
            <link>https://medium.com/@cakmak.erkut1/quick-guide-to-client-side-routing-with-react-router-a4e1dc1c569?source=rss-943023fbec8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4e1dc1c569</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-router]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <dc:creator><![CDATA[Erkut Cakmak]]></dc:creator>
            <pubDate>Wed, 29 Mar 2023 11:04:53 GMT</pubDate>
            <atom:updated>2023-03-29T11:04:53.501Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*ytGv7ne1lUKn0XN-vBUhTQ.jpeg" /></figure><h3><em>What is Client-Side Routing?</em></h3><p>Client side routing allows the app to update the URL from a link click without making another request for another document from the server. This enables faster user experience because the browser doesn’t need to request an entirely new document or re-evaluate CSS and JavaScript assets for the next page.</p><h3><strong>Using React Router</strong></h3><p>React Router is a lightweight, fully-featured routing library for the React JavaScript library. In order to use it, we first need to install the library with npm or yarn.</p><pre>npm install react-router-dom<br>yarn add react-router-dom</pre><p>Then, we want to import the {BrowserRouter} to our <strong>index.js </strong>and wrap our App component with <em>BrowserRouter</em> components. We want <em>BrowserRouter</em> to be the highest parent component in our project.</p><pre>import {BrowserRouter} from &#39;react-router-dom;<br><br>const root = ReactDOM.createRoot(document.getElementById(&quot;root&quot;));<br><br>root.render(<br>  &lt;React.StrictMode&gt;<br>    &lt;BrowserRouter&gt;<br>      &lt;App /&gt;<br>    &lt;/BrowserRouter&gt;<br>  &lt;/React.StrictMode&gt;<br>);<br></pre><p>Next, we will import {Routes, Route} components to our <strong>App.js </strong>and wrap our components with <em>Routes</em>. If we want a component to render in every page regardless of the component we visit (such as a Navbar or Header), we can exclude it from the <em>Routes.</em></p><pre>&lt;Navbar /&gt;<br>&lt;Routes&gt;<br>  &lt;Home /&gt;<br>  &lt;Profile /&gt;<br>  &lt;Help /&gt;<br>&lt;/Routes&gt;</pre><p><strong><em>How do we hook up the paths to the child components? Like this:</em></strong></p><pre>&lt;Navbar /&gt;<br>&lt;Routes&gt;<br>  &lt;Route path=&quot;/&quot; element={&lt;Home /&gt;} /&gt;<br>  &lt;Route path=&quot;/profile&quot; element={&lt;Profile prop={prop}/&gt;} /&gt;<br>  &lt;Route path=&quot;/help&quot; element={&lt;Help /&gt;} /&gt;<br>&lt;/Routes&gt;</pre><p>Here, we are basically setting the URLs for the components. First, we are defining the path for each component by using “<em>path=”</em>, and which component to render when we are directed to that path with “<em>element={component goes here}”. </em>We could also pass down any props easily by putting them inside their respective components.</p><p><strong><em>What if we want to go to the component by clicking on a menu item in our Navbar?</em></strong></p><pre>import {Link} from &#39;react-router-dom&#39;<br><br>function Navbar() {<br>    <br>    return(<br>        &lt;header className=&quot;navbar&quot;&gt;<br>            &lt;nav&gt;<br>                &lt;ul className=&quot;navlinks&quot;&gt;<br>                    &lt;Link to=&quot;/&quot;&gt;&lt;li&gt;Home&lt;/li&gt;&lt;/Link&gt;<br>                    &lt;Link to=&quot;/profile&quot;&gt;&lt;li&gt;Profile&lt;/li&gt;&lt;/Link&gt;<br>                    &lt;Link to=&#39;/help&#39;&gt;&lt;li&gt;Help&lt;/li&gt;&lt;/Link&gt;<br>                &lt;/ul&gt;<br>            &lt;/nav&gt;<br>    &lt;/header&gt;<br>    )<br>}<br><br>export default Navbar;</pre><p>In this case, we have to import a component called <em>“Link” </em>from the React Router Library. Then, we are wrapping each menu item with “<em>Link”</em>. Inside the Link component, we are re-declaring our path that we declared back in App.js using “<em>to=”. </em>Make sure to use the same paths that were declared in App.js!</p><p><em>Now these menu items will take us to the corresponding components!</em></p><h4>Resources</h4><p><a href="https://reactrouter.com/en/main/start/overview">https://reactrouter.com/en/main/start/overview</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4e1dc1c569" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arrow Function Expressions for Beginners]]></title>
            <link>https://medium.com/@cakmak.erkut1/arrow-function-expressions-for-beginners-ad0b849b80fb?source=rss-943023fbec8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad0b849b80fb</guid>
            <category><![CDATA[arrow-functions]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[functions-in-javascript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[es6-arrow-functions]]></category>
            <dc:creator><![CDATA[Erkut Cakmak]]></dc:creator>
            <pubDate>Wed, 08 Mar 2023 02:14:52 GMT</pubDate>
            <atom:updated>2023-03-08T02:14:52.305Z</atom:updated>
            <content:encoded><![CDATA[<p>Functions, as we all know, are one of the fundamental building blocks in Javascript. A function takes in an input called a “<em>parameter</em>” and returns an output after performing a task or calculating a value. They are used for giving certain instructions to Javascript that can be used repeatedly throughout the code by calling the function. It needs to be defined in the scope and called in order to be utilized.</p><p>Arrow function expressions were introduced in ES6, and are considered to be compact alternatives to the traditional function expressions. We can write our functions in a much shorter and compact way and still have the same outcome!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*v8k9UuVhFfQV9kS63KM-UQ.png" /><figcaption>A regular function with one parameter</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*MEj-2_nPi6F3TiABDp0Bgw.png" /><figcaption>An arrow function with one parameter</figcaption></figure><p>As we can see, arrow functions do exactly the same thing as regular functions, but in fewer lines of code! Curly brackets are not used when returning an expression for a function with a single parameter. Also, the parenthesis around the parameter are optional in this case.</p><p>Functions in the above example had only one parameter, but, what if we have more parameters? Let’s compare regular and arrow functions with more than one parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*sDt4PfzoVgW-IJnIojMb7w.png" /><figcaption>Regular function with two parameters</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*_8DzsA0jvzp6tfWPDWGivA.png" /><figcaption>Arrow function with two parameters</figcaption></figure><p>Notice that we added parenthesis around the parameters of our arrow function, because multiple parameters require parenthesis when declaring. We have also removed the “<em>return</em>” keyword and replaced it with “=&gt;”.</p><p>An important rule of thumb might be; if the arrow function returns an expression, no need to use curly brackets, if the arrow function contains one or more statements in its body, use curly brackets. Usage of parenthesis does not differ depending on the contents of the arrow function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*2AgWEF-O_YL0WD6IbMljCQ.png" /><figcaption>Use of parenthesis and curly brackets in arrow functions</figcaption></figure><h4><strong>Conclusion</strong></h4><p>Hopefully this short article helped you understand arrow function expressions and how they differ from regular function expressions better. Shorter syntax increases the readability and accessibility of the code, so it is considered “best practice” to utilize arrow functions!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad0b849b80fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>