diff --git a/app/javascript/components/EraShows.jsx b/app/javascript/components/EraShows.jsx
index 7e300f50..6f18aa1c 100644
--- a/app/javascript/components/EraShows.jsx
+++ b/app/javascript/components/EraShows.jsx
@@ -1,6 +1,6 @@
import { authFetch } from "./helpers/utils";
-import React, { useState, useEffect } from "react";
-import { useLoaderData, Link } from "react-router-dom";
+import React, { useEffect, useState } from "react";
+import { useLoaderData, Link, useOutletContext } from "react-router-dom";
import { Helmet } from "react-helmet-async";
import LayoutWrapper from "./layout/LayoutWrapper";
import Shows from "./Shows";
@@ -25,8 +25,7 @@ export const eraShowsLoader = async ({ params }) => {
const EraShows = () => {
const { shows: initialShows, year } = useLoaderData();
- const [viewMode, setViewMode] = useState("grid");
- const [sortOption, setSortOption] = useState("desc");
+ const { viewMode, setViewMode, sortOption, setSortOption } = useOutletContext();
const [yearsData, setYearsData] = useState(null);
const sortedShows = [...initialShows].sort((a, b) => {
@@ -51,19 +50,11 @@ const EraShows = () => {
fetchYearsData();
}, []);
- const handleViewModeChange = (mode) => {
- setViewMode(mode);
- };
-
- const handleSortOptionChange = (option) => {
- setSortOption(option);
- };
-
const renderViewToggleButtons = () => (