How do I fix this error? I copied the code from the tutorial and I still receive this error.

import React from 'react';
...

function App() {
  return (
    <div className="wrapper">
      <h1>Animals</h1>
      {albums.map(album => (
        <AnimalCard
          additional={animal.additional}
          diet={animal.diet}
          key={animal.name}
          name={animal.name}
          scientificName={animal.scientificName}
          size={animal.size}
        />
      ))}
    </div>
  )
}

export default App;
Editor at DigitalOcean, fiction writer and podcaster elsewhere, always searching for the next good nautical pun!

import React from 'react';
import PropTypes from 'prop-types';
import './AnimalCard.css'

export default function AnimalCard({
    additional,
    diet,
    name,
    scientificName,
    showAdditional,
    size
  }


AnimalCard.propTypes = {
  additional: PropTypes.shape({
    link: PropTypes.string,
    notes: PropTypes.string
  }),
  diet: PropTypes.arrayOf(PropTypes.string).isRequired,
  name: PropTypes.string.isRequired,
  scientificName: PropTypes.string.isRequired,
  showAdditional: PropTypes.func.isRequired,
  size: PropTypes.number.isRequired,
}

AnimalCard.defaultProps = {
  additional: {
    notes: 'No Additional Information'
  }
}
How do I fix this error? I copied the code from the tutorial and I still receive this error.

import React from 'react';
...

function App() {
  return (
    <div className="wrapper">
      <h1>Animals</h1>
      {albums.map(album => (
        <AnimalCard
          additional={animal.additional}
          diet={animal.diet}
          key={animal.name}
          name={animal.name}
          scientificName={animal.scientificName}
          size={animal.size}
        />
      ))}
    </div>
  )
}

export default App;
Editor at DigitalOcean, fiction writer and podcaster elsewhere, always searching for the next good nautical pun!

import React from 'react';
import PropTypes from 'prop-types';
import './AnimalCard.css'

export default function AnimalCard({
    additional,
    diet,
    name,
    scientificName,
    showAdditional,
    size
  }


AnimalCard.propTypes = {
  additional: PropTypes.shape({
    link: PropTypes.string,
    notes: PropTypes.string
  }),
  diet: PropTypes.arrayOf(PropTypes.string).isRequired,
  name: PropTypes.string.isRequired,
  scientificName: PropTypes.string.isRequired,
  showAdditional: PropTypes.func.isRequired,
  size: PropTypes.number.isRequired,
}

AnimalCard.defaultProps = {
  additional: {
    notes: 'No Additional Information'
  }
}
An easy riff for appending is using the ‘beforeend’ 1st argument + the content to append.

function showAnswer() {
    const answer = "<p>The answer is <strong>Ada Lovelace</strong>!</p>";
    document.querySelector('body').insertAdjacentHTML('beforeend', answer);
}
I’ve been trying to learn more about innerHTML and thought XSS attacks were possible when using innerHTML connected to forms (i.e. user input). Otherwise, using innerHTML to just add HTML to the DOM isn’t vulnerable to XSS. Is that how you understand it, too?

function showAnswer() {
    const answer = "<p>The answer is <strong>Ada Lovelace</strong>!</p>";
    document.querySelector('body').innerHTML = answer;
}
I get this, what happened and how to solve it?

sudo dpkg-reconfigure tzdata
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory

Current default time zone: 'Asia/Taipei'
Local time is now:      Mon Dec 29 14:21:43 CST 2014.
Universal Time is now:  Mon Dec 29 06:21:43 UTC 2014.
If you want to use NTP Syncronization you should enable port 123 in the firewall:

sudo ufw allow 123/tcp
prop-tutorial/src/App.js

import React from 'react';
import logo from './logo.svg';
import './App.css';

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.js</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
}

export default App;
prop-tutorial/src/index.js

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './components/App/App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
First, make a directory in src/components called AnimalCard then touch a file called src/components/AnimalCard/AnimalCard.js and a CSS file called src/components/AnimalCard/AnimalCard.css.

mkdir src/components/AnimalCard
touch src/components/AnimalCard/AnimalCard.js
touch src/components/AnimalCard/AnimalCard.css

Recommend

How To Customize React Components with Props Conclusion Tutorial Series: How To Code in React.js Still looking for an answer?

How To Customize React Components with Props Step 3 — Creating Predictable Props with PropTypes and defaultProps

How To Customize React Components with Props Step 2 — Building Dynamic Components with Props Adding Props

How To Customize React Components with Props Step 2 — Building Dynamic Components with Props Creating Components

How To Customize React Components with Props Step 2 — Building Dynamic Components with Props Adding Data

How To Customize React Components with Props Step 1 — Creating an Empty Project

How To Write Your First Ruby Program Step 3 — Prompting for Input

How To Write Your First Ruby Program Step 2 — Running a Ruby Program

How To Write Your First Ruby Program Step 1 — Writing the Basic “Hello, World!” Program

How To Write Your First Ruby Program Introduction

Установка и обеспечение безопасности phpMyAdmin в Ubuntu 20.04 Шаг 3 — Обеспечение безопасности phpMyAdmin

Установка и обеспечение безопасности phpMyAdmin в Ubuntu 20.04 Шаг 2 — Настройка аутентификации и прав пользователя Настройка доступа по паролю для выделенного пользователя MySQL

Установка и обеспечение безопасности phpMyAdmin в Ubuntu 20.04 Шаг 2 — Настройка аутентификации и прав пользователя Настройка доступа по паролю для учетной записи root в MySQL

Установка и обеспечение безопасности phpMyAdmin в Ubuntu 20.04 Шаг 1 — Установка phpMyAdmin

So verwenden Sie Node.js-Module mit npm und package.json Schritt 3 — Verwalten von Modulen Module prüfen

So verwenden Sie Node.js-Module mit npm und package.json Schritt 3 — Verwalten von Modulen Module deinstallieren

So verwenden Sie Node.js-Module mit npm und package.json Schritt 3 — Verwalten von Modulen Module aktualisieren

So verwenden Sie Node.js-Module mit npm und package.json Schritt 3 — Verwalten von Modulen Module auflisten

So verwenden Sie Node.js-Module mit npm und package.json Schritt 2 – Installieren von Modulen Globale Installationen

So verwenden Sie Node.js-Module mit npm und package.json Schritt 2 – Installieren von Modulen Installieren aus package.json