<?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: agentggg</title>
    <description>The latest articles on DEV Community by agentggg (@agentggg).</description>
    <link>https://dev.to/agentggg</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%2F864495%2F89175b45-c6ac-45af-94b9-27cdd198c540.jpeg</url>
      <title>DEV Community: agentggg</title>
      <link>https://dev.to/agentggg</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/agentggg"/>
    <language>en</language>
    <item>
      <title>How to present Axios data as list</title>
      <dc:creator>agentggg</dc:creator>
      <pubDate>Thu, 19 May 2022 01:27:51 +0000</pubDate>
      <link>https://dev.to/agentggg/how-to-present-axios-data-as-list-3l3c</link>
      <guid>https://dev.to/agentggg/how-to-present-axios-data-as-list-3l3c</guid>
      <description>&lt;p&gt;I have an API request from my backend to ReactJS frontend. The results is presented in JSON format. When the user press the "submit" button, I want the JSON data only for a specific key of the array of each object to presented to the user in nice list format.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;First code snippet is the JSON code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Second code is my AXIOS code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Third code is my ReactJS frontend code with the button and etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The picture is how it looks when the user press the button. I need it in list format. Meaning each entry on a new line. Currently it jumbos everything to one list&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Any thoughts?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
  {
    "userId": 1,
    "id": 1,
    "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
    "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
  },
  {
    "userId": 1,
    "id": 2,
    "title": "qui est esse",
    "body": "est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla"
  },
  {
    "userId": 1,
    "id": 3,
    "title": "ea molestias quasi exercitationem repellat qui ipsa sit aut",
    "body": "et iusto sed quo iure\nvoluptatem occaecati omnis eligendi aut ad\nvoluptatem doloribus vel accusantium quis pariatur\nmolestiae porro eius odio et labore et velit aut"
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const App = () =&amp;gt;{
  const [buttonTitle, setButtonTitle] = useState("User Data Prior To Change")

    const getAPI = ()=&amp;gt;{
      const loopList = []
      const url = "https://jsonplaceholder.typicode.com"

      axios.get(`${url}/posts`)
      .then((response)=&amp;gt;{
            const myValue = response.data
             myValue.forEach(myValueValues =&amp;gt; {loopList.push(myValueValues['title'])})
             setButtonTitle(loopList)
          })
        .catch(error =&amp;gt; console.error(`Error: ${error}`))
      }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        &amp;lt;h1&amp;gt;Click button to see list of user&amp;lt;/h1&amp;gt;
        &amp;lt;button onClick={getAPI}&amp;gt;Button to press to see all info in clean format
&amp;lt;/button&amp;gt;
        &amp;lt;ul&amp;gt;
          &amp;lt;li&amp;gt;{buttonTitle}&amp;lt;/li&amp;gt;
        &amp;lt;/ul&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fqrciLDQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pb755rf163c8jiwrdjk4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fqrciLDQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pb755rf163c8jiwrdjk4.png" alt="Image description" width="880" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>api</category>
    </item>
  </channel>
</rss>
