Skip to content

Commit

Permalink
Merge pull request #79 from dbmi-pitt/libpitt/transform
Browse files Browse the repository at this point in the history
Convert class based react Histogram to functional component
  • Loading branch information
maxsibilla authored May 24, 2024
2 parents 0f67c59 + c8f1e21 commit 8769872
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/core/Histogram.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ ChartJS.register(
Legend
);

class Histogram extends React.Component {
render() {
const {data, values} = this.props;
const Histogram = ({data, values}) => {
const render = () => {

// calculate frequency of data
let counts = {};
Expand Down Expand Up @@ -61,6 +60,8 @@ class Histogram extends React.Component {
};
return <Bar data={barData} options={options}/>;
}

return render()
}

export default Histogram;

0 comments on commit 8769872

Please sign in to comment.