My code:
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
export default class App extends Component{
render() {
const numbers = {
first : {
name : "Dad",
number : "1243342432",
info : "Best dad ever!",
birthDay : "4.2.1955"
},
second: {
name : "Mom",
number : "5435234523",
info : "Best mom ever!",
birthDay : "8.2.1967"
},
third: {
name : "Martin",
number : "5742253223",
info : "Best friend Martin ever!",
birthDay : ""
}
};
const FurtherInfo = (props) => {
<div id={props.number}>
<span className="contact__info"></span>
<span className="contact__more"></span>
</div>
}
const Name = (props) => {
<p id="contact__name">{props.name}</p>
}
const Contant = (props) => {
<li className="contact">
<Name name={props.name}></Name>
<FurtherInfo number={props.number}></FurtherInfo>
</li>
}
const listItems = Object.values(numbers).map(
person => <Contant name={person.name} number={person.number} ></Contant>
);
return (
<ul>{listItems}</ul>
);
}
}
But getting: A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.
Looked through others problems with this error, unfortunately non of them matched my issue. Usually it has to do with not including () to return
statement, however not in my case.
Anyone dealt with this before?
index.js is as always ReactDOM.render(<App />, document.getElementById('root'));