Variables in view page

  • 1. Files
    { } is used to show the data in the view page

    1. Single Value

    
                       const name="manoj";
    
                        export default function Home() {
                          return (                     
    
                                  <div>{name}</div>
                               
                          )
                        }
    
                      

    2. Multiple Value

    
    const data = [
      { uid: 21, name: ' Home', id: 1, path: '/' },
      { uid: 31, name: 'Blog', id: 2, path: 'Blog' },
      { uid: 41, name: 'About', id: 3, path: 'About' }
    ];
    
    
    
    export default function Home() {
      return (
        <ul>
              {data.map((value) => {
                return (
                  <li key={value.uid}>
                   
                      <a> {value.name} </a>
                    
                  </li>
                );
              })}
    
            
            </ul>
      )
    }
    
    
                      
    Note that the key 'map'. It is used for looping the array of object