I am new to React and how programs created with it are designed. I know its a frontend framework for easy, responsive design. My question is, is it bad practice to use a standard class (example below) for handling some of the logic behind the app? And if so, what would be a better alternative?
I do understand that react is built to use components, but I can't make sense of (or am unsure of how to) use a component simply for a class that will help handle some data that I have and will be doing things with in the background.
App.js Example
import Queue from'./classes/Queue'
const App = () => {
const x = new Queue([]);
x.enqueue('foo')
return (
<div>
// stuff
</div>
)
}
Class Example:
public Queue {
let list = [];
constructor(params) {
this.list = list;
}
Queue.prototype.enqueue = function(bar) {
// do stuff
}
}
This is just a brief mockup I made to better illustrate my question.