<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: mitchelln11</title>
    <description>The latest articles on DEV Community by mitchelln11 (@mitchelln11).</description>
    <link>https://dev.to/mitchelln11</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F341712%2F36f5f2c4-e5d8-481f-ae96-236dbcfe449d.png</url>
      <title>DEV Community: mitchelln11</title>
      <link>https://dev.to/mitchelln11</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mitchelln11"/>
    <language>en</language>
    <item>
      <title>How to Make a Reusable Function that Removes Duplicates</title>
      <dc:creator>mitchelln11</dc:creator>
      <pubDate>Sat, 11 Feb 2023 19:45:21 +0000</pubDate>
      <link>https://dev.to/mitchelln11/how-to-make-a-reusable-function-that-removes-duplicates-52id</link>
      <guid>https://dev.to/mitchelln11/how-to-make-a-reusable-function-that-removes-duplicates-52id</guid>
      <description>&lt;p&gt;I am trying to make a function as re-usable as possible.&lt;/p&gt;

&lt;p&gt;I have a JSON file containing "products" for now.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export let productList = [
    {
        id: 0,
        productName: "Men's Merrel Hiking Boots",
        price: 65.00,
        brand: "Merrell",
    },
    {
        id: 1,
        productName: "Women's Merrel Hiking Boots",
        price: 65.00,
        brand: "Merrell",
    },
    {
        id: 2,
        productName: "Natural Walking Stick",
        price: 22.00,
        brand: "Fayet",
    }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In my case, I am trying to map through these products and return all the brands without duplicates. I know I can do that with this Set function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function dedupeCheckboxOptions() {
    return [...new Set(productList.map(product =&amp;gt; product.brand))];
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works, but I am struggling to figure out a way to make this more re-usable. I would think it would look something like this so I could also use the function to maybe return the prices:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function dedupeCheckboxOptions(fullList, item) {
    return [...new Set(fullList.map(product =&amp;gt; product[item]))];
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The syntax appears to be correct, but whenever I try to pass values, whatever iterable list I send through in the fullList parameter, it comes through undefined.&lt;/p&gt;

&lt;p&gt;Ex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dedupeCheckboxOptions(productList , brand)

returns undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any thoughts as to why?&lt;/p&gt;

</description>
      <category>career</category>
      <category>productivity</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Is There a Complete In-Depth Reading/Tutorials/Guide for Full-Stack Development?</title>
      <dc:creator>mitchelln11</dc:creator>
      <pubDate>Sun, 22 Jan 2023 20:45:17 +0000</pubDate>
      <link>https://dev.to/mitchelln11/is-there-a-complete-in-depth-readingtutorialsguide-for-full-stack-development-1b2g</link>
      <guid>https://dev.to/mitchelln11/is-there-a-complete-in-depth-readingtutorialsguide-for-full-stack-development-1b2g</guid>
      <description>&lt;p&gt;Are there any resources out there that really get in depth about a true full-stack for building web or mobile applications? I know about MERN/MEAN stack which includes: M - MongoDB - used to host your data E - Express - middleware to spin up a server R/A - React/Angular - used to build the front-end through components (Made up of HTML, CSS, JS) N - Node - I think of it as an easy way to keep track of and download dependencies instead of going through one by one. It makes it easier for multiple people to use and start working locally. An index in a ways to your project.&lt;/p&gt;

&lt;p&gt;However, this doesn't really cover anything like testing, CI/CD, Docker, Kubernetes, pipelines(yml), Schemas, version control hosting(GitHub/GitLab/Bitbucket), git vs yarn, etc. Maybe this is what DevOps is?&lt;/p&gt;

&lt;p&gt;I am sure I am missing a few things, but is there anything like that out there, or do I just have to piece it together as I do my own research?&lt;/p&gt;

&lt;p&gt;It would also be good to know alternatives, like git vs yarn, MongoDb vs a traditional database like MySQL, using client-side JS vs a true back-end language like C# or Java.&lt;/p&gt;

&lt;p&gt;I have experience in the front-end; HTML, CSS, JS; but I am lacking in the back-end knowledge and am curious to learn more. I've even gotten things working locally on a C# project with MySQL, but have no idea how to move forward and host it in the cloud to make it truly a live application.&lt;/p&gt;

&lt;p&gt;Anything will help moving forward, even main keywords to look for.&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>How to Display Junction Tables in .NET Core MVC 3.1</title>
      <dc:creator>mitchelln11</dc:creator>
      <pubDate>Thu, 09 Jul 2020 15:31:16 +0000</pubDate>
      <link>https://dev.to/mitchelln11/how-to-display-junction-tables-in-net-core-mvc-3-1-2n19</link>
      <guid>https://dev.to/mitchelln11/how-to-display-junction-tables-in-net-core-mvc-3-1-2n19</guid>
      <description>&lt;p&gt;What is the best way to going about shared data with .NET Core? I understand that between the MVC model, you should keep information separated into their related areas.&lt;/p&gt;

&lt;p&gt;Ex:&lt;br&gt;
I've been working on a web app that builds Hiker profiles. It also connects to the National Park Service Rest API that populates the National Parks in the US.&lt;/p&gt;

&lt;p&gt;All previous teaching tells me to break that down into the following:&lt;/p&gt;

&lt;p&gt;Hikers:&lt;br&gt;
-HikerController&lt;br&gt;
-Hiker Model&lt;br&gt;
-Hiker Views (Create, Details, Edit, Delete)&lt;/p&gt;

&lt;p&gt;Parks:&lt;br&gt;
-ParkController&lt;br&gt;
-Park Model&lt;br&gt;
-Park Views (Create, Details, Edit, Delete)&lt;/p&gt;

&lt;p&gt;That all works great, but what happens when I want to create a Wishlist?&lt;/p&gt;

&lt;p&gt;That would need information from the Hikers AND Parks models.&lt;/p&gt;

&lt;p&gt;What is the best way to display that info on a view?&lt;br&gt;
I've come across:&lt;br&gt;
-Partial Views&lt;br&gt;
-View Components&lt;br&gt;
-Junction Table MVC (Don't know if there's a name for this), which would have the following&lt;/p&gt;

&lt;p&gt;-Wishlist Controller&lt;br&gt;
  -Wishlist Model&lt;br&gt;
  -Wishlist Views (Create, Details, Edit, Delete)&lt;/p&gt;

&lt;p&gt;I've tried, unsuccessfully, on the Partial Views and View Components. The last option seems plausible, but it also seems like overkill. It might fall in line with clean architecture, but then what's the point in View Components or Partial Views.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

</description>
      <category>help</category>
      <category>csharp</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Proper Folder Structure with Dynamic Methods?</title>
      <dc:creator>mitchelln11</dc:creator>
      <pubDate>Fri, 19 Jun 2020 15:28:29 +0000</pubDate>
      <link>https://dev.to/mitchelln11/proper-folder-structure-with-dynamic-methods-1opn</link>
      <guid>https://dev.to/mitchelln11/proper-folder-structure-with-dynamic-methods-1opn</guid>
      <description>&lt;p&gt;If I have dynamic methods that could be used on several Controllers, where should those go?&lt;/p&gt;

&lt;p&gt;Is this a possibility?  Is it the wrong way to go about folder/file structure?&lt;/p&gt;

&lt;p&gt;Ex:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

-ParkController
--with FetchParkApiMethod() inside file

-TrailController
--with FetchTrailApiMethod() inside file

--OR--

-ParkController
-TrailController

-HelperFolder
--FetchDynamicApiMethod() which could be referenced in the Park or Trail Controllers.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

</description>
      <category>help</category>
      <category>csharp</category>
      <category>net</category>
      <category>core</category>
    </item>
    <item>
      <title>.Net Core Shared Link Returning Null?</title>
      <dc:creator>mitchelln11</dc:creator>
      <pubDate>Mon, 15 Jun 2020 15:39:31 +0000</pubDate>
      <link>https://dev.to/mitchelln11/net-core-shared-link-returning-null-1adm</link>
      <guid>https://dev.to/mitchelln11/net-core-shared-link-returning-null-1adm</guid>
      <description>&lt;p&gt;I am trying to convert a .NET Framework web application to a .NET Core web application. I did start a new project, so I'm copying over info.&lt;/p&gt;

&lt;p&gt;In the Shared Views, I am trying to link to index view inside of a Hiker folder. Inside the Hiker database, I populated 2 hikers.&lt;/p&gt;

&lt;p&gt;I am trying to access the list with the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;li class="nav-item"&amp;gt;
  &amp;lt;a class="nav-link text-dark" asp-area="" asp-controller="Hiker" asp-action="Index"&amp;gt;Hikers&amp;lt;/a&amp;gt;
&amp;lt;/li&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;However, I am getting the following error message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;System.NullReferenceException: 'Object reference not set to an instance of an object.'

Microsoft.AspNetCore.Mvc.Razor.RazorPage&amp;lt;TModel&amp;gt;.Model.get returned null.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;It would make sense if there was no information, but that's not true. Any ideas why I'm getting an error?&lt;/p&gt;

&lt;p&gt;Using Standard Views&lt;/p&gt;

&lt;p&gt;Hiker Model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Hiker
{
    [Key]
    public int Id { get; set; }

    [Display(Name = "First Name")]
    public string FirstName { get; set; }

    [Display(Name = "Last Name")]
    public string LastName { get; set; }

    [Display(Name = "Street Address")]
    public string StreetAddress { get; set; }

    [Display(Name = "City")]
    public string City { get; set; }

    [Display(Name = "State")]
    public string State { get; set; }

    [Display(Name = "Latitude")]
    public string Latitude { get; set; }

    [Display(Name = "Longitude")]
    public string Longitude { get; set; }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The action I'm trying to get to &lt;em&gt;(The out-of-the-box action)&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public ActionResult Index()
{
  return View();
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;2 Hikers are populated.&lt;/p&gt;

&lt;p&gt;Thanks for any help.&lt;/p&gt;

&lt;p&gt;Update:&lt;br&gt;
This seems to only be the case for the Index. Create, Edit, Delete, Details appear to be linking properly.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>help</category>
    </item>
    <item>
      <title>Run Function after useEffect to Manipulate Data?</title>
      <dc:creator>mitchelln11</dc:creator>
      <pubDate>Fri, 12 Jun 2020 16:45:36 +0000</pubDate>
      <link>https://dev.to/mitchelln11/run-function-after-useeffect-to-manipulate-data-3cc8</link>
      <guid>https://dev.to/mitchelln11/run-function-after-useeffect-to-manipulate-data-3cc8</guid>
      <description>&lt;p&gt;I'm using the OpenWeather REST API which comes in JSON format. I know I have to make my fetch,(Axios in my case) call inside the useEffect because the component needs to render first, then calls the REST endpoint.&lt;/p&gt;

&lt;p&gt;I can log out the information, only the temperature comes in Kelvin. In this case, I need to create another function that does the conversion. The only thing I am stuck on is how to transfer the API object info to my temperature conversion function. Any thoughts on how to do this? I assume props are involved.&lt;/p&gt;

&lt;p&gt;My Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState, useEffect } from 'react';
import axios from 'axios';
import {KelvinConvert} from './MathConversions';

const LocalWeather = () =&amp;gt; {
    const [openWeather, setWeather] = useState({});

    useEffect(() =&amp;gt; {
        axiosGet();
    }, []); //  Run once on load

    const axiosGet = () =&amp;gt; {
        axios.get(`https://api.openweathermap.org/data/2.5/weather?q=London,uk&amp;amp;APPID=${process.env.REACT_APP_WEATHER_KEY}`)
        .then(data =&amp;gt; setWeather(data.data));
    }

    return (
        &amp;lt;ul id="weather-container"&amp;gt;
            &amp;lt;KelvinConvert /&amp;gt;  // Trying to add converted temperature here
            &amp;lt;li&amp;gt;{openWeather.main &amp;amp;&amp;amp; openWeather.main.temp}&amp;amp;deg;F&amp;lt;/li&amp;gt;
            &amp;lt;li&amp;gt;{openWeather.weather &amp;amp;&amp;amp; openWeather.weather[0].main}&amp;lt;/li&amp;gt;
            &amp;lt;li&amp;gt;{openWeather.name}&amp;lt;/li&amp;gt;
        &amp;lt;/ul&amp;gt;
    );
}

export default LocalWeather;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then there's my method to do the conversion.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, {useState, useEffect} from 'react';

export const KelvinConvert = props =&amp;gt; {
  const [temperature, setTemperature] = useState({props});

  useEffect(() =&amp;gt; {
    convertKelvinToFahrenheit();
  }, []);

  const convertKelvinToFahrenheit = props =&amp;gt; {
    setTemperature(((props - 273.15) * 9/5) + 32);
  }

  return {temperature};

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Not actually properly passing data to the convertKelvinToFahrenheit method.&lt;/p&gt;

&lt;p&gt;Getting the following errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./src/components/MathConversions.js
  Line 1:8: 'React' is defined but never used
no-unused-vars
  Line 4:10: 'temperature' is assigned a value but never used                                                     
no-unused-vars
Compiled with warnings.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Not sure where to go from this point.&lt;/p&gt;

</description>
      <category>react</category>
      <category>help</category>
      <category>javascript</category>
    </item>
    <item>
      <title>List of XML REST APIs?</title>
      <dc:creator>mitchelln11</dc:creator>
      <pubDate>Wed, 10 Jun 2020 00:18:36 +0000</pubDate>
      <link>https://dev.to/mitchelln11/list-of-xml-rest-apis-8m</link>
      <guid>https://dev.to/mitchelln11/list-of-xml-rest-apis-8m</guid>
      <description>&lt;p&gt;I know JSON is the better and newer format for REST APIs. However, businesses still list XML along with JSON in their job descriptions. I just want to find and use one in my portfolio just to get practice and show that I know how to work with them. The crazy part is, I've been searching most of the day, and all I am finding is JSON format REST APIs.&lt;/p&gt;

&lt;p&gt;Does anybody have a list of REST APIs that at least offer XML as an option?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

</description>
      <category>help</category>
      <category>xml</category>
      <category>rest</category>
      <category>api</category>
    </item>
    <item>
      <title>Undefined Nested Object in REST API with React Hooks?</title>
      <dc:creator>mitchelln11</dc:creator>
      <pubDate>Thu, 04 Jun 2020 16:30:27 +0000</pubDate>
      <link>https://dev.to/mitchelln11/undefined-nested-object-in-rest-api-with-react-hooks-3j02</link>
      <guid>https://dev.to/mitchelln11/undefined-nested-object-in-rest-api-with-react-hooks-3j02</guid>
      <description>&lt;p&gt;Having trouble trying to access nested objects in the OpenWeather REST API. Getting full results in Postman, but not when trying to render.&lt;/p&gt;

&lt;p&gt;Postman results(condensed):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
"coord": {
    "lon": -0.13,
    "lat": 51.51
},
"weather": [
    {
        "id": 500,
        "main": "Rain"
    }
],
"main": {
    "temp": 290.38
},
"name": "London"
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Using &lt;code&gt;const [openWeather, setweather] = useState([]);&lt;/code&gt;&lt;br&gt;
If I want to access name, I can easily do that with &lt;code&gt;openWeather.name&lt;/code&gt;, which works just fine when returning "London".&lt;/p&gt;

&lt;p&gt;However, if I try &lt;code&gt;openWeather.weather[0].main&lt;/code&gt;, it comes back as undefined. Why would that be?&lt;/p&gt;

&lt;p&gt;If I change my setWeather to: &lt;code&gt;setWeather(data.data.weather[0].main);&lt;/code&gt;, I am able to return "Rain" by using &lt;code&gt;openWeather.main&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Anything would help, thanks.&lt;/p&gt;

</description>
      <category>react</category>
      <category>help</category>
    </item>
    <item>
      <title>Help with Image Click Through (Like a Carousel) using React Hooks</title>
      <dc:creator>mitchelln11</dc:creator>
      <pubDate>Wed, 06 May 2020 15:38:19 +0000</pubDate>
      <link>https://dev.to/mitchelln11/help-with-image-click-through-like-a-carousel-using-react-hooks-4njg</link>
      <guid>https://dev.to/mitchelln11/help-with-image-click-through-like-a-carousel-using-react-hooks-4njg</guid>
      <description>&lt;p&gt;I have a component that is similar to a carousel, only I'm just clicking through using React Hooks. I have a full-width image with a left and a right click arrow. (I only have the right arrow click for now. Also not worrying about conditionals just yet.)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I am setting the images in the useState&lt;/li&gt;
&lt;li&gt;Setting the default image to be the 0 index of the state values.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let indexValue = 0; // Initial slide index value
    let currentSlide = slides[indexValue];
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Image, alt, and title display properly, cool.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Created a right arrow click function that's supposed to update the image.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    const arrowRightClick = () =&amp;gt; {
        currentSlide = slides[indexValue + 1];
        console.log(currentSlide);
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;When I click on the right arrow, the console log does indeed display the next image, img2.jpg, however, the image itself never updates. &lt;/p&gt;

&lt;p&gt;??? What am I doing wrong?&lt;/p&gt;

&lt;p&gt;I feel like I have to do useEffect somewhere.&lt;br&gt;
I've tried this(doesn't work):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useEffect(() =&amp;gt; {
        function changeSliderImage(currentSlide) {
            setSlides(currentSlide.setSlides);
        }
        return () =&amp;gt; {
        &amp;lt;img src={currentSlide.source} alt={currentSlide.title} title={currentSlide.title} className="slider-img" /&amp;gt;
    }
    }, [])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I feel like it's close to something like the previous code, but I'm not sure.&lt;/p&gt;

&lt;p&gt;Full code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState, useEffect } from 'react';

function Carousel() {

    const [slides, setSlides] = useState([
        {
            source: "../images/img1.jpg",
            title: "Half Moon Pier"
        },
        {
            source: "../images/img2.jpg",
            title: "Port Washington Rocks"
        },
        {
            source: "../images/img3.jpg",
            title: "Abandoned Rail"
        }
    ]);

    let indexValue = 0; // Initial slide index value
    let currentSlide = slides[indexValue]; // variable index value we can reference later

    // Index value moves up, but doesn't update the image. Why???
    const arrowRightClick = () =&amp;gt; {
        currentSlide = slides[indexValue + 1];
        console.log(currentSlide);
    }

    return (
        &amp;lt;div className="carousel-block"&amp;gt;
            &amp;lt;div className="flex-container"&amp;gt;
                &amp;lt;div id="slider"&amp;gt;
                    &amp;lt;div className="slide"&amp;gt;
                        &amp;lt;img src={currentSlide.source} alt={currentSlide.title} title={currentSlide.title} className="slider-img" /&amp;gt;
                        &amp;lt;div className="arrows"&amp;gt;
                            &amp;lt;div id="arrow-left"&amp;gt;&amp;lt;i className="fas fa-arrow-alt-circle-left"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/div&amp;gt;
                            &amp;lt;div id="arrow-right" onClick={arrowRightClick}&amp;gt;&amp;lt;i className="fas fa-arrow-alt-circle-right"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;/div&amp;gt;
                    &amp;lt;/div&amp;gt;

                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    )
}

export default Carousel;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Any help would be appreciated&lt;/p&gt;

</description>
      <category>react</category>
      <category>hooks</category>
      <category>carousel</category>
      <category>useeffect</category>
    </item>
    <item>
      <title>React Help with Put Method on Bootstrap Modal</title>
      <dc:creator>mitchelln11</dc:creator>
      <pubDate>Thu, 19 Mar 2020 15:52:32 +0000</pubDate>
      <link>https://dev.to/mitchelln11/react-help-with-put-method-on-bootstrap-modal-42g0</link>
      <guid>https://dev.to/mitchelln11/react-help-with-put-method-on-bootstrap-modal-42g0</guid>
      <description>&lt;p&gt;I have a flashcard project I am building with React and Bootstrap. I am using json-server to simulate that my json-file is on another server. &lt;br&gt;
(Project on localhost:3000, data.json file on localhost:3001).&lt;/p&gt;

&lt;p&gt;The front-side of the card reads a title while the back reads the rest of the material from each object. I am originally pulling the data using fetch, but I am using Axios to Post and Delete cards. The one that's tripping me up is the put method.&lt;/p&gt;

&lt;p&gt;Right now, I have a button per card that says "update" which opens a Bootstrap modal. I can't for the life of me figure out how to pass the id to the modal based on which update button is clicked. Then I want to populate the modal fields with the existing data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Original Call to the json file&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;componentDidMount() {
      let url = "http://localhost:3001/collections"
      fetch(url)
      .then(response =&amp;gt; response.json())
      .then(data =&amp;gt; {
        console.log(this.state.collections)
          let collections = data.map((collection) =&amp;gt; {
              return (
                &amp;lt;div key={collection.id}&amp;gt;
                  &amp;lt;div className="cards"&amp;gt;
                      &amp;lt;div className="cards-inner"&amp;gt;
                          &amp;lt;div className="card-front"&amp;gt;
                              &amp;lt;h3&amp;gt;{collection.title}&amp;lt;/h3&amp;gt;
                          &amp;lt;/div&amp;gt;
                          &amp;lt;div className="card-back"&amp;gt;
                              &amp;lt;div&amp;gt;
                                  {collection.cards.map((words) =&amp;gt;
                                  &amp;lt;div key={words.id}&amp;gt;
                                      &amp;lt;h4&amp;gt;{words.word}&amp;lt;/h4&amp;gt;
                                      &amp;lt;p&amp;gt;{words.definition}&amp;lt;/p&amp;gt;
                                  &amp;lt;/div&amp;gt;
                                  )}
                              &amp;lt;/div&amp;gt;
                          &amp;lt;/div&amp;gt;
                      &amp;lt;/div&amp;gt; 

                  &amp;lt;/div&amp;gt;
                  **&amp;lt;button className="btn btn-primary"  data-toggle="modal" data-target="#putCard"&amp;gt;
                    Update Card
                  &amp;lt;/button&amp;gt;**

                  &amp;lt;button className="btn btn-primary" 
                    onClick={() =&amp;gt; this.deleteCollection(collection.id)}&amp;gt;
                    Delete Card
                  &amp;lt;/button&amp;gt;
                &amp;lt;/div&amp;gt;
              )
          });
          this.setState({collections: collections});
      });
  }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Modal&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="modal fade" id="putCard" tabIndex="-1" role="dialog" aria-labelledby="putCardlLabel" aria-hidden="true"&amp;gt;
            &amp;lt;div className="modal-dialog" role="document"&amp;gt;
              &amp;lt;div className="modal-content"&amp;gt;
                &amp;lt;div className="modal-header"&amp;gt;
                  &amp;lt;h5 className="modal-title" id="putCardlLabel"&amp;gt;Update Card&amp;lt;/h5&amp;gt;
                  &amp;lt;button type="button" className="close" data-dismiss="modal" aria-label="Close"&amp;gt;
                    &amp;lt;span aria-hidden="true"&amp;gt;&amp;amp;times;&amp;lt;/span&amp;gt;
                  &amp;lt;/button&amp;gt;
                &amp;lt;/div&amp;gt;

                &amp;lt;div className="modal-body"&amp;gt;
                  &amp;lt;ModalPutCard /&amp;gt;
                &amp;lt;/div&amp;gt;

                &amp;lt;div className="modal-footer"&amp;gt;
                  &amp;lt;button type="button" className="btn btn-secondary" data-dismiss="modal"&amp;gt;Close&amp;lt;/button&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Here is the form inside the ModalPutCard&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;render(props) {
        return (
        &amp;lt;form onSubmit={this.handleSubmit}&amp;gt;
            &amp;lt;div className="form-group" id={this.state.value}&amp;gt;
                &amp;lt;label htmlFor="cardTitle"&amp;gt;Title:&amp;lt;/label&amp;gt;
                &amp;lt;input type="text" className="form-control" name="title" id="cardTitle" aria-describedby="text" onChange={this.handleChange} value={this.state.title} /&amp;gt;
                &amp;lt;label htmlFor="cardState"&amp;gt;State:&amp;lt;/label&amp;gt;
                &amp;lt;input type="text" className="form-control" name="cardState1" id="cardState1" aria-describedby="text" onChange={this.handleChange} /&amp;gt;
                &amp;lt;label htmlFor="cardComponent"&amp;gt;Component:&amp;lt;/label&amp;gt;
                &amp;lt;input type="text" className="form-control" name="cardComponent1" id="cardComponent1" aria-describedby="text" onChange={this.handleChange} /&amp;gt;
                &amp;lt;hr&amp;gt;&amp;lt;/hr&amp;gt;
                &amp;lt;label htmlFor="cardState"&amp;gt;State:&amp;lt;/label&amp;gt;
                &amp;lt;input type="text" className="form-control" name="cardState2" id="cardState2" aria-describedby="text" onChange={this.handleChange} /&amp;gt;
                &amp;lt;label htmlFor="cardComponent"&amp;gt;Component:&amp;lt;/label&amp;gt;
                &amp;lt;input type="text" className="form-control" name="cardComponent2" id="cardComponent2" aria-describedby="text" onChange={this.handleChange} /&amp;gt;
                &amp;lt;hr&amp;gt;&amp;lt;/hr&amp;gt;
                &amp;lt;label htmlFor="cardState"&amp;gt;State:&amp;lt;/label&amp;gt;
                &amp;lt;input type="text" className="form-control" name="cardState3" id="cardState3" aria-describedby="text" onChange={this.handleChange} /&amp;gt;
                &amp;lt;label htmlFor="cardComponent"&amp;gt;Component:&amp;lt;/label&amp;gt;
                &amp;lt;input type="text" className="form-control" name="cardComponent3" id="cardComponent3" aria-describedby="text" onChange={this.handleChange} /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;button type="submit" className="btn btn-primary"&amp;gt;Submit&amp;lt;/button&amp;gt;
        &amp;lt;/form&amp;gt;
        );
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I would think it would be is simple as this.state.title, or maybe this.props.title (Or whatever one I'm working on), however, I always get an undefined, which makes me think I'm never passing the id to the modal in order to display the values.&lt;/p&gt;

&lt;p&gt;Can I use the regular Bootstrap Modal?&lt;br&gt;
Is this even possible?&lt;/p&gt;

&lt;p&gt;Any help or hints would be awesome.&lt;br&gt;
I also read through the components and state section of the React docs, trying to do it without Hooks at this point.&lt;/p&gt;

&lt;p&gt;Here is my github: &lt;a href="https://github.com/mitchelln11/react-flip-card-repo"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>json</category>
      <category>bootstrap</category>
      <category>axios</category>
    </item>
  </channel>
</rss>
