DEV Community

Discussion on: Lazy Loading😴😴 In React [Easy way]

Collapse
 
kepta profile image
Kushan Joshi • Edited

Nice article Sai!

One humble suggestion, 'please format your code'. At first glance I couldn't understand what was going on as your code looks like this

export default (props)=>{

function formatDate(date, format){
    return moment(date).format(format);
  };

    return(
          <ul >
         </ul>
   )
}

No matter how cool the logic is, It is always a good idea to follow a consistent formatting.

I know fiddling with indentation sucks, that is why we have a tool called prettier, which takes care of formatting for you. I strongly suggest you use that.

Side note: Why do you need to define formatDate inside the react component ?