I have a "rails" array within my constructor which are imported components:
import MusicRail from '../../components/MusicRail';
import GamesRail from '../../components/GamesRail';
import MoviesRail from '../../components/MoviesRail';
constructor(props) {
super(props);
this.rails = [
MusicRail,
GamesRail,
MoviesRail
]
}
How can I clone or duplicate the first and last objects to then push to the rails array? Can I use Object.assign() ?
I'm getting the first and last objects from the array like so:
const rails = this.rails;
const firstObject = this.rails[0];
const lastObject = this.rails.slice(-1)[0];