Parsing error: Unterminated regular expression

Viewed 26
import React from "react";
import { ListGroup, ListGroupItem } from "reactstrap";
import { FaCheckDouble } from "react-icons/fa";

const Todo =({todos}) => {
   return(
    
    <ListGroup>
         <ListGroupItem>
        {
           todos.map((todo) => {
            const {id, title, body, userId} = todo
                    <h4>{title}</h4> // error starting from here
                    <h6>{body}</h6>
           })
        }
         </ListGroupItem>
    </ListGroup>
   )
}
1 Answers

You need the return inside the map

import React from "react";
import { ListGroup, ListGroupItem } from "reactstrap"; 
import { FaCheckDouble } from "react-icons/fa"; 

const Todo =({todos}) => { 
return(

<ListGroup>
  <ListGroupItem>
    { todos.map((todo) => { 
        const {id, title, body, userId} = todo; 
        return(
            <React.Fragment key={id}>
                <h4>{title}</h4>
                <h6>{body}</h6>
            </React.Fragment>
        ) 
    })}
  </ListGroupItem>
</ListGroup>
) }
Related