sachin.kabadi
Tue Apr 16 2024
#nextJs #TypeScript
Function Argument Deconstructing: Deconstructing function arguments can make your code cleaner and more readable.
Function Argument Deconstructing: Deconstructing function arguments can make your code cleaner and more readable.
// Before deconstruction
const BlogPost = (props) => {
const { title, content, author } = props;
// Render blog post using props
return (
{props.title}
{props.content}
Written by: {props.author}
);
};
// After deconstruction
const BlogPost = ({ title, content, author }) => {
// Render blog post with title, content, and author
return (
{title}
{content}
Written by: {author}
);
};