Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SyntaxError:Unexpected token, expected ","

Error it self

How it looks in VScode

Thats Toollsit component

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

import React, { Component } from 'react';
 import Toolitem from './Toolitem'
 import App from '../App';
  const styles = {
  ul:{
    listStyle:"none", 
     width:"300px"
    }
  }


  export default  function Toollsit(toto,title){
  return(
   {toto.map((toto)=>{return (<Toolitem toto={toto} />)})} 
  );
 };

Thats Toolitem component
import React from ‘react’;

      const Toolitem = ({toto}) => {
         return (
             <div>
                <li>
                 {toto.title}
                </li>
              </div>
              );
            };

            export default Toolitem;
      

And thats my App.js

       import react from 'react';
       import Toollsit from './components/Toollsit'
         function App(props) {
           const toto =[
            {id:1,title:'First',completed:true},
            {id:2,title:'Second',completed:false},
            {id:3,title:'Third',completed:true},
         ];
             return (
                <span className="wrapper">
                 <Toollsit toto={toto} />
                </span>
               );
              }

          export default App;

Thank you for any help,critic I truly appreciate your feedback

>Solution :

You must place the map function in <React.Fragment> tag (equivalent: <>). Additionally, the arguments should be destructed object.

  export default  function Toollsit({toto, title}){
  return(<>
   {toto.map((toto)=>{return (<Toolitem toto={toto} />)})} 
  </>);
 };
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading