<?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 Paulina on Medium]]></title>
        <description><![CDATA[Stories by Paulina on Medium]]></description>
        <link>https://medium.com/@paulinavita?source=rss-39e4c16288b7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GTLR6CFfzr9Y2CxulJCVqw.jpeg</url>
            <title>Stories by Paulina on Medium</title>
            <link>https://medium.com/@paulinavita?source=rss-39e4c16288b7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 11:43:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@paulinavita/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[Learn Web Scraping To Get Insight — How Does Sun Exposure Affect Our Mental Health?]]></title>
            <link>https://paulinavita.medium.com/learn-web-scraping-to-get-insight-how-does-sun-exposure-affect-our-mental-health-543e42e3fdc0?source=rss-39e4c16288b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/543e42e3fdc0</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[suicide]]></category>
            <category><![CDATA[mental-health]]></category>
            <dc:creator><![CDATA[Paulina]]></dc:creator>
            <pubDate>Tue, 18 May 2021 10:01:52 GMT</pubDate>
            <atom:updated>2021-05-18T13:05:16.186Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Learn Web Scraping To Get Insight — How Does Sun Exposure Affect Our Mental Health?</strong></h3><h4><strong>Intent</strong></h4><p>A few days ago a colleague of mine asked about getting data from Wikipedia in a sense of scraping. I remember doing it once using Puppeteer in Node.js to get people’s data from their online profile and check whether it fits or matches certain criteria that were formulated. But I never actually do it with Python.</p><p>As it provoked me to get my hands-on the scraping process, along the way I found that I could as well try to make a conclusion the data result. <em>So, shall we?</em></p><p>I will be scraping data from Wikipedia and WHO. And using <strong>BeautifulSoup</strong> as the scraper. <strong>This article will cover the whole scraping process and little about the data analysis (since I am not very fond of the process).</strong></p><h4><strong>Hypothesis</strong></h4><p>The country with more sunlight hours will have fewer mental health problems. (Side note: On <strong>Schizophrenia</strong> &amp; <strong>Suicide occurrence</strong>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YWRIWXUcSGOm2zPJ" /><figcaption>Photo by <a href="https://unsplash.com/@steve_j?utm_source=medium&amp;utm_medium=referral">Steve Johnson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4><strong>Code &amp; Scraping Process</strong></h4><p>In our virtualenv as usual, we will install these packages. But just a small disclaimer, I am not 100% familiar with all the packages’ features, so please do simplify the usage as per your need if they double in function. Then import in your .py file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b805c4cae346a3f8869133441ccd9ec1/href">https://medium.com/media/b805c4cae346a3f8869133441ccd9ec1/href</a></iframe><p>We will init the bs4 as per the docs.</p><p>Line 1–3: We first hit the webpage with urlopen, then we use the find_all method on the html returned from urlopen.</p><p>Line 4: We will be using lots of find_all in this tutorial. What we want to find is this table below with its table HTML tag. Thus we use soup.find_all(‘table’).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*gUAq4U8It6-TGyFqYEe8Vg.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b8c9e552634b1d5d0a7d38950ede57c/href">https://medium.com/media/6b8c9e552634b1d5d0a7d38950ede57c/href</a></iframe><p>We can try printing the result, it will get us the HTML part of our designated table .</p><p>Line 11: We will try to get only the content using a loop on the table.</p><p>Line 12: We find_all &lt;tr&gt; tag aka row (refer to the image below if you are not familiar with HTML tags)</p><p>Line 15: And on each row, we want to find_all td.</p><p>Line 19, 21, 25: Each data we will append into an array so that we can use it for creating DataFrames with pandas</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5Ixv__UKB3E9eU_F.png" /><figcaption>HTML tags for table</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/275d8b87bbda7b46f01a45aeea0b894b/href">https://medium.com/media/275d8b87bbda7b46f01a45aeea0b894b/href</a></iframe><p>Now, let’s create our first dataframe like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8e993b0d76c294b5b1f4e881f36c821/href">https://medium.com/media/e8e993b0d76c294b5b1f4e881f36c821/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*fUXpYywDkH8NGh-CDUEi6w.png" /><figcaption>df result from scraping the schizophrenia table</figcaption></figure><p><strong>Ok, we successfully scrape schizophrenia data from wiki!</strong> 🎉</p><p>Next, we will take another data from wiki that is Sunshine Duration (links on reference). We will <strong>repeat</strong> the same steps from find_all table, we will loop the rows, and get the cell.</p><p>Line 14–27: The difference will only be in the data processing, as the Sunshine Duration data is given per city, we must <strong>categorize and count </strong>(Line 25) the total as a country and find the avg.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7123e4843d436025212afed8b7ee7681/href">https://medium.com/media/7123e4843d436025212afed8b7ee7681/href</a></iframe><p>Then we will learn to combine both data, into a new DataFrame, since we already have 2 data frames, so we shall now able to see the plot and gain insights (fingers crossed! 🤞🏻)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8d86d31b133c31a8ece0ddce3274343/href">https://medium.com/media/a8d86d31b133c31a8ece0ddce3274343/href</a></iframe><p>Line 8: Join the data frame together with pandas join</p><p>Line 9: df.dropna(inplace=True) to remove all null data as we only need complete data for this time</p><p>Line 11: Print the correlation matrix for our conclusions</p><p>Line 12: I extracted the combined data to .csv first</p><p>Line 21–26: We can try to find the linear regression</p><p>Line 27–29: Visualize the data with seaborn scatter plot, and draw the regression line with matplotlib</p><p>Line 31: I wanted to see the Least Square plot, but you can skip this one.</p><p><strong>That’s it! We have successfully scraped Wikipedia and learn to make plots from the data we scrape! 🎊 🥳</strong></p><h4>Result and Discussions</h4><p><strong>Schizophrenia</strong></p><p>From the correlation matrix, we see that there is a correlation between total sunshine hrs/year and the DALY rate of Schizophrenia.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*hNeFrKlfJxnGRdcPHIOxXA.png" /><figcaption>correlation matrix for schizophrenia</figcaption></figure><p>But as we can see from the regression, although the trend is actually dropping, the data is very scattered so it cannot be concluded that on places with the longer sun exposure, the DALY rate will be lower.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JSaz-VC8YiqI2PwppRl1mQ.png" /></figure><p><strong>Suicide Occurrence</strong></p><p>I also did the same process on suicide data of 2019 from WHO (links on reference) and using Heatmap to plot the correlation matrix. As we can see, the correlation coefficient is -0.34, meaning that there is no correlation between Sun exposure and suicide rate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*phqpz96m7Fwul376L0AHfw.png" /></figure><h4><strong>Suggestions and Thoughts</strong></h4><p>I enjoyed the whole learning process although the results were not as expected. Few other things to note are many factors contributing to schizophrenia and suicide, such as health centers&#39; availability, alcohol, stress (traffic, family), personal wealth, etc. So we <strong>do </strong>need more variables and not only rely upon sun exposure.</p><p>If you are interested in gaining further insights, I would propose this for suggestions:</p><ol><li>Group the data per continent (and delete the outliers), and regress each continent to find interesting trends</li><li>As a disease grow exponentially, maybe we could try using y log on the y axis and rank on the x axis and see how the trend will be?</li></ol><p><strong>️ ️️☀️ But hey, at least we learn something new today! ☀️</strong></p><h4><strong>References</strong></h4><p>You can find the code <a href="https://github.com/paulinavita/curicuriwiki/tree/feat/all/py">here</a>, including the Suicide data processing that I don’t cover in this tutorial. (But promise you, basically a similar process!✌🏼)</p><ul><li><a href="https://apps.who.int/gho/data/node.main.MHSUICIDEASDR?lang=en">GHO | By category | Suicide rate estimates, age-standardized - Estimates by country</a></li><li><a href="https://en.wikipedia.org/wiki/List_of_cities_by_sunshine_duration">List of cities by sunshine duration - Wikipedia</a></li><li><a href="https://en.wikipedia.org/wiki/Epidemiology_of_schizophrenia">Epidemiology of schizophrenia - Wikipedia</a></li><li><a href="https://towardsdatascience.com/step-by-step-tutorial-web-scraping-wikipedia-with-beautifulsoup-48d7f2dfa52d">Web Scraping Wikipedia with BeautifulSoup</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=543e42e3fdc0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pattern-recognize yourself,  you will be more humane than AI]]></title>
            <link>https://paulinavita.medium.com/pattern-recognize-yourself-you-will-be-more-humane-than-ai-d6826077c85d?source=rss-39e4c16288b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6826077c85d</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[wisdom]]></category>
            <category><![CDATA[self-awareness]]></category>
            <dc:creator><![CDATA[Paulina]]></dc:creator>
            <pubDate>Mon, 14 Sep 2020 04:51:39 GMT</pubDate>
            <atom:updated>2020-09-14T16:33:25.062Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pattern-recognize yourself, you will be more humane than AI.</h3><p>That was a clickbait. AI is not human in any possible way. But you are here, so let’s get to the point.</p><p>Most of us probably have heard, learned, or searched about AI (Artificial Intelligence) and how it works. With my limited knowledge from online courses, I figure that I would just summarize AI as an <em>object that</em><strong><em> learns from patterns </em></strong><em>and </em><strong><em>replicates patterns from lots of other patterns. </em></strong>And those patterns are the data.</p><p>Many developers are now working to expand the capability of AI. But what does it take for us to actually <em>outsmart</em> it?</p><blockquote>“If we could do what-the-AI-is-running in ourself, what could we even gain? Is it possible to predict and be aware of our own ‘next’ movement?””</blockquote><p>Pulling the strings back to when I was 14, I clearly remember this line, in the voice of my meditation guru — not knowing why I was there honestly, but anyway, he said:</p><blockquote>“The only permanent thing is change, and everytime you realize that there a slight changes (in your breath’s character or body vibration), then you have gained a little bit more of <strong>wisdom</strong>. Nothing needs to be done, just realize that it changes characteristics.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GB_L5bxgcag5-lYwcLoBHg.jpeg" /></figure><p>If I may extract his words in a non-sophisticated version — for your preference, it would be: “<em>Realize every the changes around you, and you will be wiser.”</em></p><p><strong>Gaining wisdom is nothing near to a <em>Eureka!</em> moment</strong> or like the shock of being electrocuted. We do plant our wisdom over time through our daily circumstances and continuously manifest its growth. I am still on the path of harvesting it, and I believe you are too. This is the part that makes us <em>humane.</em></p><p>But yes, most are mere subconscious acts, because consciously <strong>we rarely aware or recognize the patterns and changes that happen in our mind.</strong></p><blockquote>Without that <em>recognition,</em> we are slowly paddling away from what differs us from AI. <strong>Wisdom.</strong></blockquote><p>The way I am going to storytell today is based on my lifetime (still 20ish years only) reflection and learnings. To some extent, it also might not be parallel to your view. And for those of you who like facts, I am very sorry to say that there won’t be any valid journal citation or relateable authors that I know of at this point.</p><h3><strong>Why recognizing <em>your</em> pattern is important</strong></h3><p>Pattern is how something is organized to occur, there is nothing fancy to it.</p><p>Citing myself before, gaining wisdom is (one of) the path of becoming <em>more humane</em>. So next, how do I define <em>humane</em>? There might be psychological guidelines out there to correctly calibrate the value. However, in this article, I am scoping the term <em>humane </em>as an adjective that defines the ability of a human to be <strong>aware</strong> of things that we <strong>choose.</strong> This awareness will lead us to wisdom, and I believe until now, this is not something that the AI has.</p><figure><img alt="Thought-proccess, from reasoning into actions into result and drives pattern" src="https://cdn-images-1.medium.com/max/1024/1*fisaa8r58ZAZB8S49jbSNQ.jpeg" /><figcaption>Reasonings turn into actions and then to result. Over time, this creates a pattern in your mind. src: scribble</figcaption></figure><p>Connecting the dots, when you are <strong>recognizing a pattern in your life </strong>you will most likely <strong>have a series of previous actions </strong>as well as the <strong>series of results</strong>. And since you are the owner of your own mind, subconsciously you will also have <strong>a series of reasonings/hypotheses </strong>in regards to your actions. After all, this is a basic thinking scheme. In the end, without acknowledging that, someway we have created a <strong>pattern</strong> — or automation upon the decision.</p><p>Notwithstanding the complexity of our unique individual processes, we often still deem ourselves making the <strong>wrong</strong> <strong>choices </strong>(self-valued) or finding ourselves dead-stuck in a problem. So in what manner this could happen? Is it by virtue of the universe or are we lacking something?</p><p>How about this,</p><blockquote>We do not understand our own characteristics, even more whether it creates pattern thus we are not manifesting the wisdom we have.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r34FdhfFG07kfE_X" /><figcaption>Photo by <a href="https://unsplash.com/@shunyakoide?utm_source=medium&amp;utm_medium=referral">Shunya Koide</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>How pattern recognition can humanize ourself</strong></h3><h4><strong>1. Here, you don’t </strong>(or try to) <strong>realize your response to emotions.</strong></h4><p>Simply put, knowing where we stand when we make a decision. <strong>Emotion is not about morals and cannot be judged morally</strong>. There is no bad or good in emotion as opposed to behaviors under law. There is no such thing as anger is bad as to happy is good morally.</p><p><strong>So now ask yourself,</strong> how do you respond to responsibility under a happy, vibrant situation compared to your response under fear or stress.</p><p>Your college senior/boss asks you to come up tomorrow with 5 ideas to solve a fund loss issue in your division. You might see yourself thinking, <em>“Great, 5 is not many for a night” </em>when you are contented, contrarily you might see <em>“24h for 5 ideas, what the hell?” </em>and don’t stop there, check (or just remember) on your bodily movements, how many tabs did you open on the internet to brainstorm? how many of them you scrolled and how many of them you read intently in each emotional condition? How do you respond to your partner’s / friends’ greeting? Shorter messages? Longer ones? How fast do you pick the ideas and what parameters you take — in each condition — in order to be sure that the solutions you come up with are prudent?</p><p>Now, let me rephrase the question. <strong>Were you aware of your emotions when you are making those choices (or steps that lead to the choices)?</strong></p><blockquote>“I was furious when I came up with idea A, it was a half-assed idea but who cares? I’ll just serve what they want” — I, you, someone</blockquote><blockquote>“I was under the fear of being harassed in public, so coming up with idea B could help me at least look a little bit smarter, although it is not original.” — I, you, someone</blockquote><p>Do you see what I see? Our emotional condition could possibly affect our reasoning level.</p><p>There must be a <strong>typical </strong>action or <strong>tendency </strong>of action<strong> </strong>as a result of a certain emotion. Reflecting upon those bodily reactions in a period of time (of your choice), you will then receive <strong>a series of bodily data </strong>that shows a <strong>pattern</strong> of your response to emotions.</p><p>Use this to predict your next moves when a new responsibility comes.</p><h4><strong>2. Here</strong>, <strong>you don’t realize that change is perpetual, not your condition.</strong></h4><p>I told you, right. Change is permanent, and anything else is impermanent.</p><p>Maybe in your 20s, your love for indie music is consuming 70% of your online query search. But then in your 30s, you realize that indie music is just as tacky as pop music and you shift to death metal. Or okay, you used to loved Chinese dramas, but now you find them absolutely oblivious.</p><p>There is nothing wrong with your entertainment taste, both current or in the past. <strong>But now try to ask yourself,</strong> how and why did the shift begin, did I deliberately choose to, or were they the reaction after a certain turn of events?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DtKN0EyfSvVbllB0" /><figcaption>Photo by <a href="https://unsplash.com/@neonbrand?utm_source=medium&amp;utm_medium=referral">NeONBRAND</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Realistically speaking, I have found <em>my</em> pattern that I would like to share. But you can skip this story if it’s too long, TL;DR: I found my ‘running away’ pattern in life.</p><p>In every (literally) finish line of education level — so kindergarten to Uni in my case, but I’m skipping a lot— I always shifted and tended to run away either for a harder or easier choice. In late Junior High, I wanted to enter (<em>run away to</em>) the Language Major because I felt stupid and just didn’t want to get an ugly report card. After many tearful nights, my parents managed to convince me to take Science. And it worked. I wasn’t dumb. Still in the top 10ish. Late HS, I threw away the thought of taking to CS major thinking I was <em>still</em> too dumb. <em>So again, I ran </em>and I picked Clinical Pharmacy <em>and not Med school</em> also assuming I wouldn’t get such bad reports in Pharm because it’s easier. And sure it was easy-okay. Finishing Uni, I felt like there is no challenge in Pharmacy and I am not that dumb just to be a Pharmacist, and took a shift again into learning CS-ish stuff. So again, <em>I ran.</em></p><p>It is totally okay if you would like to say <em>it’s very teenager stuff la to want A then B then C, nothing to worry.</em> Sure as hell, I am not worried at any cost. Because I meet a version of myself in every turns and I get raise my consciousness level due to those events. But nevertheless, I unlocked the maze to my mind.</p><p>So my pattern would be: <strong>When — </strong>mostly somewhere near the end of a big thing, <strong>What — </strong>myself wanting to heighten or lower my limit, <strong>Why — </strong>self-fulfillment of being able to egoistically run but succeeds</p><p>Like my meditation guru said, <em>once you know the characteristics of your breath, you gain a pearl of small wisdom. </em><strong><em>And finding your pattern is that wisdom.</em></strong></p><blockquote><strong>“Those patterns and characteristics are what you should look for.”</strong></blockquote><p>There must be a <strong>typical</strong> turning point in each situation. Reflecting upon your points, you will then receive <strong>a series of events</strong> or <strong>reasons</strong> that show a <strong>pattern </strong>of your response to changes.</p><p>Use this to predict your next moves before you come to a decision.</p><h4><strong>3. Here, you don’t go for a helicopter view for a series of events.</strong></h4><p>A.k.a how we see things in the past. I would want to props my best friend for introducing me to this word — <em>heli-view —</em> she has my respect for her capability on using this heli-view technique.</p><p>Heli-view is basically a term for taking a zoomed-out view or a God’s eye view over a plight in an attempt to uncover core problems and conflicting factors.</p><blockquote>Given one time a company offers you a project, a job, a scholarship, etc, with not much of thought you accept it. In another time when an opportunity comes, you simply go yes — take it. Those were all fast-paced decisions with certainty yet with fright that there might not be other opportunities. But if we try to zoom things out, I am pretty sure we often skip the step to examine what uncalculated risk that would come alongside the opportunity because the excitement is heaving your mind. Maybe this does not happen frequently in business matter, however, it is often a blind spot in daily life. Those yes-es taken merely are automated yes-es<em>. </em>It is not taken upon the reflection of our past while pulling a heli-view<em>.</em></blockquote><p>I believe everyone once has at least a few similar experiences in the past. You could take the initiative to pull a zoomed-out view and find uncalculated factors there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-oZY-eSn5xDo9yUv" /><figcaption>Photo by <a href="https://unsplash.com/@sandiejo?utm_source=medium&amp;utm_medium=referral">Jo San Diego</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Please be aware that you do <strong>have control over your mind</strong> and it is not the situation that is <strong>controlling</strong> your choice, it is vice versa. This is also a part of getting close with your <em>heli-view, </em>you are able to see the bigger picture and you will choose because your mind chooses it, not because of the situation.</p><blockquote>I am conscious of my past scrutiny, so as for today I am able to choose wiser and be more present.</blockquote><p>Most of the time from my experience, finding blind spots with the heli-view techniques would be the <strong>typical</strong> data that I could cultivate for my next plight. Reflecting upon those points, we will then gains <strong>another dataset of our very own prediction pattern.</strong></p><h3>TL;DR</h3><p>As we become more accustomed to pattern-recognize ourselves (emotions, reasonings, helicopter-view) we gain more wisdom — becoming wiser. And wisdom is the most humane thing <em>a human</em> can have, whereas an AI does not (yet). So to start outsmarting the AI, take time to recognize those patterns.</p><blockquote>Next time you are just dead-stuck, think, do you see similar <strong>sequences<em> </em></strong>in the past? Recognize your pattern. Then, use it for your next decision.</blockquote><p><em>Writer’s note:</em> This writing is a by-product of an isolated person longing for life-long discussion. Therefore, cherishing these thoughts is a sign of hope that the readers would also gain insights into how their mind works. May all beings be happy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6826077c85d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Welcoming Vue 3.x?]]></title>
            <link>https://paulinavita.medium.com/welcoming-vue-3-x-f0de84e4d258?source=rss-39e4c16288b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0de84e4d258</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Paulina]]></dc:creator>
            <pubDate>Sun, 21 Jul 2019 07:00:27 GMT</pubDate>
            <atom:updated>2019-07-21T07:16:46.817Z</atom:updated>
            <content:encoded><![CDATA[<h3>Welcoming Vue 3.x? Basic Getting Started Guide.</h3><p>Vue months ago (if you get the pun, though), Vue.js teams had sent out their newest Vue Function Components. Although it is said to still be under RFC on their <a href="https://github.com/vuejs/rfcs">github page</a>, it is still worth the time to check. As stated on their docs, the Vue Function was certainly inspired by React Hooks API however with Vue’s very own reactivity system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xg4ZkSYAKYoJ5TV_vrEVug.png" /><figcaption>Vue 3.0!</figcaption></figure><p>Which then for some of Vue frequent users might not be a satisfying update, as Vue is sure known for is simplicity and its neat partition on their scaffold.</p><blockquote>The craze is whether or not, when you update, <strong><em>you have you rewrite all of your code</em></strong>, like in Angular 2?</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl4Jz2yBZOouDO2vII%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fl4Jz2yBZOouDO2vII%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2Fl4Jz2yBZOouDO2vII%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="217" frameborder="0" scrolling="no"><a href="https://medium.com/media/45592fa18ec105ff443c60e4dbab6fc4/href">https://medium.com/media/45592fa18ec105ff443c60e4dbab6fc4/href</a></iframe><p>Yup! That ain’t happening. Vue 2 will still be fully fine (: By this far, I believe that you should be familiar with the Vue 2.x environment. This article will preview some basic changes and comparisons. We are going to create a Fox Fetching site that has a getFox button and an increment number button.</p><p>Before going to the function API, we’re going to start from creating a new Vue Project. On my <a href="https://github.com/paulinavita/hello-to-vue-3x/tree/vue-2x/client/src">github in the branch vue-2x</a> I upped a simple code without the Vue Function API. You may start your own <strong><em>vue create client.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*CgnFGzEVIjY4VbqwF-Q17g.png" /><figcaption>This is what we are going to make</figcaption></figure><p>Our Home.vue as a Class based</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f66e6484c9a6ff99fbf0cf8d4f7440d1/href">https://medium.com/media/f66e6484c9a6ff99fbf0cf8d4f7440d1/href</a></iframe><p>With one component Fox.vue</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ad36dbc82b087dd1ea87a8bccc8e2e0/href">https://medium.com/media/2ad36dbc82b087dd1ea87a8bccc8e2e0/href</a></iframe><h3>Let’s start!</h3><p>First, we need to install the api to our previously created Vue client.</p><pre>npm install vue-function-api --save</pre><p>Then, we’re going to add this to our <strong><em>router.js</em></strong> file :</p><pre><strong>import</strong> { plugin } <strong>from</strong> &#39;vue-function-api<br>Vue.use(plugin)</pre><p>Then, to our <strong><em>Home.vue </em></strong>we are going to first import few functions from the api. We’re going to use basic functions for this tutorial :</p><pre><strong>import</strong> { value, computed, watch, onCreated } <strong>from</strong> &quot;vue-function-api&quot;;</pre><p>Vue functions now will wrap its exported datas such as methods, watchers, computed properties and data in Vue 2.x in a function called <strong><em>setup(props, ctx) {…}. </em></strong><em>But to import components, you still need to import it outside the setup function.</em></p><p>Other than that you <strong>must remember to return the setup() function with an object listing all the variables used inside setup.</strong></p><h4>Adding Data Values</h4><p>Adding data values is much simpler with Vue 3.x.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/21ac54be5cf0a75c3edbfb322ec43376/href">https://medium.com/media/21ac54be5cf0a75c3edbfb322ec43376/href</a></iframe><p>It is nice to remember that upon calling these data we don’t need to use <em>this </em>anymore since they’re already in one scope. If you’re familiar with React Hooks API then this is similar to how they work.</p><h4>Creating Methods + Computed &amp; Watch</h4><p>Methods are created <strong>inside </strong>the setup() function, by saving it into a const. The same goes with a computed property. Computed property receives a callback of the computed data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e451c9c64b17f3b1b07c007a3de010a3/href">https://medium.com/media/e451c9c64b17f3b1b07c007a3de010a3/href</a></iframe><p>Watchers in Vue 3.0 is an imported function which receive two parameters. First the getter and a callback for the desired outcome. It will watch the first argument, and do something on the second argument.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93b5bb033d6a4f93f84d15924cfd1466/href">https://medium.com/media/93b5bb033d6a4f93f84d15924cfd1466/href</a></iframe><h4><strong>Lifecyles</strong></h4><p>The new lifecycle inside Vue Function are called using the <strong>“on..” </strong>prefix. Such as onCreated, onMounted etc. These functions receive a callback of the desired outcome.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cede44023172c75113e00bb6f2e44d78/href">https://medium.com/media/cede44023172c75113e00bb6f2e44d78/href</a></iframe><h4>Full Code</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e1ef1662a99dbdfae70e54a475d9490/href">https://medium.com/media/4e1ef1662a99dbdfae70e54a475d9490/href</a></iframe><p>Or you can go to <a href="https://github.com/paulinavita/hello-to-vue-3x/tree/vue-3x">my github page on the brach Vue 3.</a>x.</p><p>I guess that has covered most of the basics changes! Their docs (that are still on RFC) are good so if you need more coverage you can always dig them. Again, Vue 3.0 has backward compatibility means that the old one would not be deprecated and you should not suddenly change all of your code. Have great day.!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0de84e4d258" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>