I’m just done writing my first react app and I would love if you can take a look at the page or code(specially the code) and let me know of any improvements that I could make or things that I could have done better.
Empty data is still valid data. You should not be throwing an error here, and handle this condition in the view layer: CamperAPI.jsx:15
Board.jsx:9
You don’t have to use constructor just to set the initial state.
export class Board extends React.Component {
state = {
camperArray: [],
isLoading: false
}
...
}
Board.jsx:49
Here you are passing an instance of parent component as a prop to child component.
Does this child component need the whole instance to perform its function?
When component needs to communicate something to parent component, a callback interface will usually suffice.
Sorter.jsx:15
Facebook discourages the use of uncontrolled components.
Make sure this distinction is clear to you. More info here:
Sorter.jsx:24
You can define propTypes as a static prop of class component.
CamperList.jsx:8
Wrapping everything in a div appears to be unnecessary here.
Also what made you chose to extract some logic behind the rendering in its own function, separate from the component? I’m not sure if it’s a bad practice, but it strikes me as unusual.
I haven’t mentioned a lot of other stuff. A lot of good stuff. Your code is good and clean. And you haven’t even used linter!