<?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 Alicia Dinkel on Medium]]></title>
        <description><![CDATA[Stories by Alicia Dinkel on Medium]]></description>
        <link>https://medium.com/@alicia.dinkel?source=rss-8dd9139c39fb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rjPGCk8R-lQZwJFo7edQUg.png</url>
            <title>Stories by Alicia Dinkel on Medium</title>
            <link>https://medium.com/@alicia.dinkel?source=rss-8dd9139c39fb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:55:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alicia.dinkel/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[Understanding React useEffect]]></title>
            <link>https://medium.com/@alicia.dinkel/understanding-react-useeffect-f397b9de4aea?source=rss-8dd9139c39fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/f397b9de4aea</guid>
            <category><![CDATA[dev]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Alicia Dinkel]]></dc:creator>
            <pubDate>Sun, 16 Feb 2020 22:17:13 GMT</pubDate>
            <atom:updated>2020-02-17T02:20:52.572Z</atom:updated>
            <content:encoded><![CDATA[<p>The React useEffect hook allows us to perform side effects inside functional components without needing to write a class component. Side effects could include fetching data from an api, updating the DOM, or subscribing to external data sources.</p><p>useEffect replaces 3 different lifecycle methods previously used in class components: ComponentDidMount, ComponentDidUpdate, and ComponentWillUnmount.</p><p><strong>Replacing ComponentDidMount &amp; ComponentDidUpdate</strong></p><p>useEffect takes a callback as its first argument and runs that callback after every first render and every update, which allows us to consolidate duplicate code you would have previously written in both ComponentDidMount &amp; ComponentDidUpdate into one hook.</p><p>Previously we would have to write componentDidMount to trigger after the component mounts and then componentDidUpdate to trigger after any updates to your component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jsNGkndnW_4lBklyJ9Unjw.png" /></figure><p>Now because useEffect is called on every render, we can simplify those two lifecycle methods to a single function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uLq_xzfF5VIsS01URpUprw.png" /></figure><p>But, in some cases, we may not want to call this function on every render, we may only want to re-render if something specific is changed, in which case we can customize our useEffect hook with dependencies.</p><p>useEffect takes an array of dependencies as a second argument. If given dependencies, React will only run the effect if one of the dependencies has been updated between renders.</p><p>In my video examples below, I created a simple form and a useEffect hook that enables or disables the password field based on whether or not there is an <strong>email </strong>value. I added console.log statements to show when useEffect and the render method run.</p><p>First, we will pass in no dependency array. As you will see, useEffect runs on every render.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F391858107%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F391858107&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F856712236_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="995" frameborder="0" scrolling="no"><a href="https://medium.com/media/a7629873eee48d153e74493d17545f4d/href">https://medium.com/media/a7629873eee48d153e74493d17545f4d/href</a></iframe><p>Next, since we only care if <strong>email</strong> has changed between each render, we pass <strong>email </strong>in the dependency array. You will see that when we change the input value for email, useEffect will log in the console signaling that it ran the effect. If we change the password, it will not. This is what we want.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F391858345%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F391858345&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F856712610_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="995" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b94fc4c022e1940a702ab0881b14312/href">https://medium.com/media/2b94fc4c022e1940a702ab0881b14312/href</a></iframe><p>Another option we have is to use an empty dependency array. This will tell React that we only want to run the effect on the first render, replicating the behavior of componentDidMount. If we pass an empty array into my example and run the code, you will see that useEffect logs in the console only once, after the first render.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F391858488%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F391858488&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F856712836_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="995" frameborder="0" scrolling="no"><a href="https://medium.com/media/8062bf87992e4e251acd8c19e8ca7885/href">https://medium.com/media/8062bf87992e4e251acd8c19e8ca7885/href</a></iframe><p>It’s also worth noting that useEffect differs from componentDidMount and componentDidUpdate in that it does not block the browser from updating, so if you are making asynchronous API calls for data that your page will need to display, you may need to use async await in a callback within your useEffect function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*UQLNYRgP1yV_K6XcfTOdSA.png" /></figure><p><strong>Replacing componentWillUnmount</strong></p><p>useEffect can also be used to replace class lifecycle method componentWillUnmount by providing us with the ability to perform cleanup for our effects. useEffect can optionally return a function that cleans up after it.</p><p>If we return a function from our useEffect hook, this will be considered the cleanup function and will run when the component unmounts, but also because effects run for every render, the cleanup for an effect will run before running the effect the next time.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F391860759%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F391860759&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F856716126_640.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="640" height="356" frameborder="0" scrolling="no"><a href="https://medium.com/media/402d0557d554e13b5499069311bad93f/href">https://medium.com/media/402d0557d554e13b5499069311bad93f/href</a></iframe><p>Reasons we may want to use useEffect with clean up could be to clean up eventListeners that were added in our useEffect hook or to unsubscribe from external data sources that we subscribed to in the hook to prevent any memory leaks.</p><p>If you want to play around with this example some more, <a href="https://codesandbox.io/s/react-useeffect-example-6eudf?fontsize=14&amp;hidenavigation=1&amp;module=%2Fsrc%2FForm.js&amp;theme=dark">here is a link to my codesandbox</a>.</p><p>I hope this helped you gain a better understand of how and why to use the useEffect hook. If you have any feedback, please leave it in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f397b9de4aea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build an Amazon Alexa Skill using AWS Lambda]]></title>
            <link>https://medium.com/@alicia.dinkel/build-an-amazon-alexa-skill-using-aws-lambda-306ae0bac26d?source=rss-8dd9139c39fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/306ae0bac26d</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[alexa]]></category>
            <category><![CDATA[alexa-skills]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Alicia Dinkel]]></dc:creator>
            <pubDate>Mon, 13 Aug 2018 23:18:59 GMT</pubDate>
            <atom:updated>2020-02-16T23:17:04.829Z</atom:updated>
            <content:encoded><![CDATA[<h4>A straightforward guide to getting started building your first skill.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HmYOqC1AGJqHf9GYJhmOpw.jpeg" /></figure><h3><strong>Getting Started</strong></h3><p>Before you start, you should have a good idea of what you would like your skill to do and the type of interactions you want users to be able to have with it.</p><p>Amazon offers three pre-build models (Flash Briefing Skill API, Smart Home Skill API, and Video Skill API) as well as a Custom Skill option that allows you to build your own interaction model. This post will focus on steps to build a Custom Skill.</p><p>There are also two ways to create a Custom Skill, either by writing a function to run in AWS’s Lambda serverless compute service or by writing a web service and hosting with a cloud service of your choosing. We will use Lambda, which accepts code written in Node, Java, Python, or C#. With Lambda, as with other serverless computing services, you only pay when your code is run. There is a fairly generous <a href="https://aws.amazon.com/free/">free tier</a> that AWS offers as well.</p><h3><strong>Build Your Interaction Model</strong></h3><p>To create your skill, you will first need to create an account or sign in to <a href="https://developer.amazon.com/">Amazon Developer Services.</a> Make sure you use an email address that is linked to your Alexa device.</p><p>Next, navigate to the Alexa Skills Kit Developer Console and select Create Skill. Once you fill out your skill information you will be directed to the Build page, where we’ll walk through the steps of building your Alexa Interaction Model.</p><h4><strong>Invocation</strong></h4><p>First, you will need to choose your invocation name. This is how Alexa will identify a user’s request to launch your skill. For example, in the phrase <em>“Alexa, open Jeopardy”</em>, the invocation name is <strong>jeopardy</strong>.</p><h4><strong>Intents</strong></h4><p>Next, you will need to indicate your intents. An intent represents the action requested from a user. If you are building a translator skill, one intent might be <strong>Translate</strong>. Note that the name of the intent is not the same as what a user will say to request an action, but we’ll get to that next.</p><p>Amazon also includes four built-in and required intents to make set up a bit easier — <strong>Fallback</strong>, <strong>Cancel</strong>, <strong>Help</strong>, and <strong>Stop</strong>. It is important to remember that handlers for each of these will need to be included when writing your code.</p><h4><strong>Sample Utterances</strong></h4><p>Now that we have an intent, we are ready to set up the sample utterances for that intent. These are the possible phrases that a user might say to request an action (invoke an intent) from the skill. It is best to give as many sample utterances as you can, so that each user can interact with your skill in a natural way.</p><p>For our translator skill, an example phrase might be: <em>“What’s hello in French”</em>.</p><p>You may be wondering how your skill extracts the word and language that you want to translate. This is where slots come in.</p><h4><strong>Slots</strong></h4><p>Slots are the info included in your sample utterances that are variable data. Their values will be extracted from the utterances and sent to your intent as arguments.</p><p>In the utterance <em>“Translate bread and water to German”</em> we will need to extract two variables, the phrase ‘bread and water’ and the language we want to translate it to, German. In this case, we could call our slots <strong>PhraseToTranslate </strong>and <strong>Language.</strong></p><p>We denote slots in our sample utterances by wrapping them in curly braces.</p><p>This is how your Sample Utterances and Slots might look:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b4zURS7-pZAExSSxz_rVzg.png" /></figure><p>Next, you will need to select a Slot Type. This will tell the skill what possible values it might expect to receive in each slot. If creating a custom slot type, you will need to provide example slot values as well.</p><h4><strong>Build Model</strong></h4><p>Finally, save your model and navigate back to the Skill Builder Checklist and select Build Model. You can now view and edit your model in the JSON Editor.</p><p>Congratulations! You have successfully created your Interaction Model.</p><h3>Create Your Lambda Function</h3><p>Now is a good time to get set up with AWS Lamba. Sign up or sign in to <a href="https://aws.amazon.com/">AWS</a> and navigate to the Lambda service.</p><p>Lambda functions for Alexa skills can only be hosted in the following regions: US East (N. Virgina), US West (Oregon), EU (Ireland), Asia Pacific (Tokyo). Make sure one of these are selected in your upper right menu, then select Create Function.</p><h4><strong>Create Function</strong></h4><p>Select how you plan to build your skill — whether you want to author from scratch or use a pre-built blueprint or repository. There are quite a few repos you can get started from on <a href="https://github.com/alexa">GitHub</a> as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F7_bUciqhYzA0EuSMHEYjg.png" /></figure><h4>Configure Function</h4><p>Next, you’ll need to add the trigger that will run your function. In this case, it will be Alexa Skills Kit.</p><p>Connecting your function to the Skills Kit with the Interaction Model you created is fairly simple:</p><ol><li>Copy the ARN from the upper right hand corner in your Lambda function window.</li><li>Head back over to your Developer Console and click Endpoint from the Skill Builder Checklist.</li><li>Select AWS Lambda ARN as your Endpoint Type and paste your ARN into the field for the appropriate region(s).</li><li>Copy your Skill Id and paste it into your Lambda Configure Triggers window.</li></ol><p>Once you save your changes, you’re ready to upload your code!</p><h4>Add Code</h4><p>There are a few ways you can add your code to the Lambda function: write and edit your code with the provided inline code editor, upload a .zip file, or upload a file from Amazon S3. I chose to upload a .zip file so I could use my preferred code editor. I will say that this process was pretty tedious, especially for a first time skill builder who had several rounds of testing and revisions.</p><h3>Test Your Skill</h3><p>Once your code is added to the function, you will want to perform some tests to ensure your skill is working.</p><p>The skill can be tested both in your Developer Console and in the Lambda environment.</p><h4>Testing in Developer Console</h4><p>To start, let’s navigate back to the Developer Console and click Test. Try to invoke your skill by typing or speaking in the Alexa simulator. Try something like “Alexa, open &lt;invocation name&gt;”. If that’s successful, try using one of your sample utterances.</p><p>If you’re having difficulty invoking your skill with these tests, you may want to set up some tests in Lambda as well.</p><h4>Testing in Lambda Console</h4><p>Head back to your Lambda function, navigate to the drop down next to the Test button and choose Configure Test Events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*p7d-blageEhGKQxL2w09VQ.png" /></figure><p>You can choose a template and manually update the code in the test event body, or simply copy the JSON input over from one of the tests you tried in the Alexa simulator.</p><p>Once your Lambda tests are configured, you can test your code quickly in the Lambda Console.</p><p>Once you’re passing your tests, you are ready to start interacting with Alexa.</p><h4>Try it out with Alexa</h4><p>If you used the same email to create your skill that you use with your Alexa app, you should now be able to go the Skills library and add your skill.</p><p>Now you can start testing your new skill with your Alexa-enabled device!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=306ae0bac26d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>