Skip to content

Instantly share code, notes, and snippets.

@adityatyagi
Created June 7, 2022 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adityatyagi/0fda76f9c0c1524d84e79cf729ea5e8e to your computer and use it in GitHub Desktop.
Save adityatyagi/0fda76f9c0c1524d84e79cf729ea5e8e to your computer and use it in GitHub Desktop.
// DemoOutput.js
import React from "react";
const DemoOutput = (props) => {
// a sorting function that has some complex sorting algorithm
const sortedItems = props.items.sort((a,b) => {
// some elaborate sorting algorithm
return a-b;
})
return (
<div>
<h3>{props.title}</h3>
<ul>
{sortedItems.map(item => {
return <li>{item}</li>
})}
</ul>
</div>
);
};
export default React.memo(DemoOutput);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment