DEV Community

Discussion on: How would you refactor this JS function?

Collapse
 
rinah profile image
rinahs • Edited

const lineChecker = (line, isFirstLine) => {
if (line !== '') {
if (isFirstLine) {
return <h1>${line}</h1>;
}
return <p>${line}</p>;
}
return <br />;
}