<?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 Showbi on Medium]]></title>
        <description><![CDATA[Stories by Showbi on Medium]]></description>
        <link>https://medium.com/@showbi699176?source=rss-9465e18937c4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SH9vkrOS6WtY12GMRJEZkA.jpeg</url>
            <title>Stories by Showbi on Medium</title>
            <link>https://medium.com/@showbi699176?source=rss-9465e18937c4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 03:39:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@showbi699176/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[Axios in React and React Native]]></title>
            <link>https://medium.com/@showbi699176/axios-in-react-and-react-native-3c35168fab06?source=rss-9465e18937c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c35168fab06</guid>
            <category><![CDATA[axios]]></category>
            <dc:creator><![CDATA[Showbi]]></dc:creator>
            <pubDate>Wed, 26 Oct 2022 05:03:41 GMT</pubDate>
            <atom:updated>2022-10-26T05:03:41.781Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*YeQst_isfuB1QaUg7BCXag.png" /></figure><h4>| Overview of Axios</h4><p>The major application of the well-known module Axios is to deliver asynchronous HTTP requests to REST APIs.</p><p>When performing CRUD operations, this library comes in quite handy.</p><h4>| Why should I use Axios when I can use a multitude of libraries to perform these requests?</h4><h4>Here are some reasons to send HTTP queries using Axios as your client:</h4><ol><li>It works well with JSON data by default. In contrast to other options like the Fetch API, you frequently don’t need to define your headers. Alternately, carry out tedious operations like transforming the request body into a JSON string.</li><li>Both the client and the server can utilize Axios. You should be aware that Axios may be utilized outside of the browser if you are developing a Node.js application.</li><li>Axios tackles errors efficiently. In contrast to the Fetch API, where you must manually check the status code and throw the error.</li><li>You receive range errors 400 and 500 via Axios.</li><li>Function names in Axios can be matched to any HTTP method.<br>Example: You implement the .get() technique to carry out a GET request.</li><li>Axios accomplishes more with fewer codes. As opposed to the Fetch API, you just require one. To get your desired JSON data, use the .then() callback.</li></ol><h4>How to Launch Axios Using React</h4><p>You will require three items:</p><ol><li>An existing React project or create React app in your project.</li></ol><pre>npx create-react-app my_app</pre><p>2. Axios must be installed using npm/yarn.</p><pre>npm install axios<br>or<br>yarn add axios</pre><p>You may import this library into your file after installing Axios and use it to create an HTTP request.</p><p>import axios from &quot;axios&quot;;</p><p>3. An API endpoint for making requests</p><p>To obtain and edit post data, you’ll utilize the JSON Placeholder API.</p><p><strong>Here’s an example of utilizing Axios to Get the users’s data…</strong></p><p>To submit a GET request, you build a new module and import Axios into it.</p><pre>import React from &#39;react&#39;;<br>import axios from &#39;axios&#39;;<br><br>export default class PersonList extends React.Component {<br>  state = {<br>    persons: []<br>  }<br><br>  componentDidMount() {<br>    axios.get(`https://jsonplaceholder.typicode.com/users`)<br>      .then(res =&gt; {<br>        const persons = res.data;<br>        this.setState({ persons });<br>      })<br>  }<br><br>  render() {<br>    return (<br>      &lt;ul&gt;<br>        {<br>          this.state.persons<br>            .map(person =&gt;<br>              &lt;li key={person.id}&gt;{person.name}&lt;/li&gt;<br>            )<br>        }<br>      &lt;/ul&gt;<br>    )<br>  }<br>}</pre><p><strong>Example for Post request in axios</strong></p><p>In this phase, you will utilize Axios in conjunction with another HTTP request technique known as POST.</p><p>You must add a new component called PersonAdd to your React project. <br>Construct PersonAdd.js and include the following code to build a form that accepts user input and POSTs the content to an API…</p><pre>import React from &#39;react&#39;;<br>import axios from &#39;axios&#39;;<br><br>export default class PersonAdd extends React.Component {<br>  state = {<br>    name: &#39;&#39;<br>  }<br><br>  handleChange = event =&gt; {<br>    this.setState({ name: event.target.value });<br>  }<br><br>  handleSubmit = event =&gt; {<br>    event.preventDefault();<br><br>    const user = {<br>      name: this.state.name<br>    };<br><br>    axios.post(`https://jsonplaceholder.typicode.com/users`, { user })<br>      .then(res =&gt; {<br>        console.log(res);<br>        console.log(res.data);<br>      })<br>  }<br><br>  render() {<br>    return (<br>      &lt;div&gt;<br>        &lt;form onSubmit={this.handleSubmit}&gt;<br>          &lt;label&gt;<br>            Person Name:<br>            &lt;input type=&quot;text&quot; name=&quot;name&quot; onChange={this.handleChange} /&gt;<br>          &lt;/label&gt;<br>          &lt;button type=&quot;submit&quot;&gt;Add&lt;/button&gt;<br>        &lt;/form&gt;<br>      &lt;/div&gt;<br>    )<br>  }<br>}</pre><p><strong>Example of Put request in axios</strong></p><p>Make a PUT request to update an asset. Under this instance, you can update the original post.</p><p>You’ll need to make another button to do this. However, this time the button will invoke a method to update a post:</p><pre>import axios from &quot;axios&quot;;<br>import React from &quot;react&quot;;<br><br>const baseURL = &quot;https://jsonplaceholder.typicode.com/posts&quot;;<br><br>export default function App() {<br>  const [post, setPost] = React.useState(null);<br><br>  React.useEffect(() =&gt; {<br>    axios.get(`${baseURL}/1`).then((response) =&gt; {<br>      setPost(response.data);<br>    });<br>  }, []);<br><br>  function updatePost() {<br>    axios<br>      .put(`${baseURL}/1`, {<br>        title: &quot;Hello World!&quot;,<br>        body: &quot;This is an updated post.&quot;<br>      })<br>      .then((response) =&gt; {<br>        setPost(response.data);<br>      });<br>  }<br><br>  if (!post) return &quot;No post!&quot;<br><br>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;{post.title}&lt;/h1&gt;<br>      &lt;p&gt;{post.body}&lt;/p&gt;<br>      &lt;button onClick={updatePost}&gt;Update Post&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p><strong>Axios request to Deletion</strong></p><p>Throughout this sample, you’ll learn how to use axios.delete and specify a URL as an argument to delete objects from an API.</p><pre>import React from &#39;react&#39;;<br>import axios from &#39;axios&#39;;<br><br>export default class PersonRemove extends React.Component {<br>  state = {<br>    id: &#39;&#39;<br>  }<br><br>  handleChange = event =&gt; {<br>    this.setState({ id: event.target.value });<br>  }<br><br>  handleSubmit = event =&gt; {<br>    event.preventDefault();<br><br>    axios.delete(`https://jsonplaceholder.typicode.com/users/${this.state.id}`)<br>      .then(res =&gt; {<br>        console.log(res);<br>        console.log(res.data);<br>      })<br>  }<br><br>  render() {<br>    return (<br>      &lt;div&gt;<br>        &lt;form onSubmit={this.handleSubmit}&gt;<br>          &lt;label&gt;<br>            Person ID:<br>            &lt;input type=&quot;number&quot; name=&quot;id&quot; onChange={this.handleChange} /&gt;<br>          &lt;/label&gt;<br>          &lt;button type=&quot;submit&quot;&gt;Delete&lt;/button&gt;<br>        &lt;/form&gt;<br>      &lt;/div&gt;<br>    )<br>  }<br>}</pre><h4>Error Handling utilizing Axios</h4><p>If there is a mistake when submitting the request…</p><p>For example, you may send the incorrect data, submit a request to the incorrect endpoint, or have a network issue.</p><p>To mimic an issue, submit a request to a non-existent API endpoint: /posts/asdf.</p><p>This query will result in a 404 error code</p><pre>const baseURL = &quot;https://jsonplaceholder.typicode.com/posts&quot;;<br><br>export default function App() {<br>  const [post, setPost] = React.useState(null);<br>  const [error, setError] = React.useState(null);<br><br>  React.useEffect(() =&gt; {<br>    // invalid url will trigger an 404 error<br>    axios.get(`${baseURL}/asdf`).then((response) =&gt; {<br>      setPost(response.data);<br>    }).catch(error =&gt; {<br>      setError(error);<br>    });<br>  }, []);<br>  <br>  if (error) return `Error: ${error.message}`;<br>  if (!post) return &quot;No post!&quot;<br><br>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;{post.title}&lt;/h1&gt;<br>      &lt;p&gt;{post.body}&lt;/p&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>In this situation, Axios will raise an error and execute the .catch() callback code instead of the .then() callback.</p><p>In this method, we take the error data and place it in a state that alerts our user to the issue. So, if there is a problem, the error message will be displayed.</p><p>Whenever we execute that code, we will receive the message “Error: Request failed with status code 404.”</p><h4>Here are several Axios concise methods…</h4><ul><li>axios.request(config)</li><li>axios.head(url[, config])</li><li>axios.get(url[, config])</li><li>axios.post(url[, data[, config]])</li><li>axios.put(url[, data[, config]])</li><li>axios.delete(url[, config])</li><li>axios.options(url[, config])</li><li>axios.patch(url[, data[, config]])</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c35168fab06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Native vs Hybrid vs Web]]></title>
            <link>https://medium.com/@showbi699176/native-vs-hybrid-vs-web-9a5e83a17eaf?source=rss-9465e18937c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a5e83a17eaf</guid>
            <category><![CDATA[web-apps]]></category>
            <category><![CDATA[hybrid-apps]]></category>
            <category><![CDATA[native-app]]></category>
            <category><![CDATA[native-vs-hybrid-vs-web]]></category>
            <dc:creator><![CDATA[Showbi]]></dc:creator>
            <pubDate>Mon, 11 Jul 2022 04:17:05 GMT</pubDate>
            <atom:updated>2022-07-11T04:17:05.627Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YG26ay7pBnDSroqAhieHeQ.jpeg" /></figure><p><strong>What is a Web Application?</strong></p><p>A web app is a computer program that uses a web browser to perform a particular function. A responsive website that can be visited using a desktop or mobile browser is referred to as a web application. The cost of web apps is lower than that of mobile applications. Additionally, they are simpler to construct and maintain.</p><p>Built with web technologies</p><p>(e.g., HTML, CSS, and JavaScript)</p><p><strong>What is a Native Application?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*RRzRsZ34laiTEvu_-bOn7w.png" /></figure><p>Native programs are designed to run on a specific operating system. They can utilize all of the features of the device. They are available for download through app stores. (Such as Apple’s App Store or Google Play).</p><p>They are able to use the camera, GPS, accelerometer, compass, contact list, and other functionalities. Additionally, they may use gestures (either standard operating-system gestures or new, app-defined gestures). Additionally, native apps are able to operate offline and utilize the device’s notification system.</p><p>(e.g.,</p><p>: XCode –swift, object-c</p><p>: Android studio –java, kotlin )</p><h4><strong>pros and cons of Native app</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dCbq_l7lRgGGV9_ZFY39rQ.png" /><figcaption>pros and cons</figcaption></figure><p><strong>What is a Hybrid Application?</strong></p><p>Web and native app functionality are combined in hybrid applications. They are accessible in an app store, much like native apps, and may make use of the many functionalities that the device has to offer. They rely on HTML being rendered in a browser just like web applications, with the exception that the browser is incorporated within the program.</p><p>(e.g., React Native, Flutter)</p><p><strong>Hybrid apps differ from Web apps in certain ways.</strong></p><p>· Web apps will use less time and money than hybrid apps.</p><p>· Web apps Performance is slower than a hybrid app.</p><p>· Web applications operate exclusively in browsers, whereas hybrid applications run on both installed devices and browsers.</p><p>· Web apps take less time to design than hybrid apps do.</p><p>· Both web apps and hybrid apps have significant levels of code reuse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y_RgONY_Yb6p2cBEwdQ47A.jpeg" /><figcaption>Native vs Hybrid</figcaption></figure><p>· Native apps will require more time and money than hybrid apps.</p><p>· Native apps perform quickly compared to hybrid and web apps.</p><p>· Only a few OSes support native apps.</p><p>· A native app’s development will take some time.</p><p>· Compared to hybrid and web apps, native apps have extremely little code reuse.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a5e83a17eaf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>