Skip to content

Commit 49b9bd3

Browse files
committed
MainSlider complete
1 parent e47f9d4 commit 49b9bd3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/app/components/MainSlider.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, { useState, useEffect } from 'react';
22
import Slider from 'rc-slider';
33
import Tooltip from 'rc-tooltip';
4-
import { changeSlider, pause } from '../actions/actions';
5-
import { useStoreContext } from '../store';
4+
import { changeSlider, pause } from '../RTKslices';
5+
// import { useStoreContext } from '../store';
6+
import { useDispatch, useSelector } from 'react-redux';
67
import { HandleProps, MainSliderProps } from '../FrontendTypes';
78

89
const { Handle } = Slider; // component constructor of Slider that allows customization of the handle
@@ -28,10 +29,13 @@ const handle = (props: HandleProps): JSX.Element => {
2829

2930

3031
function MainSlider(props: MainSliderProps): JSX.Element {
32+
const dispatch = useDispatch();
3133
const { snapshotsLength } = props; // destructure props to get our total number of snapshots
32-
const [{ tabs, currentTab }, dispatch] = useStoreContext(); // we destructure the returned context object from the invocation of the useStoreContext function. Properties not found on the initialState object (dispatch) are from the useReducer function invocation in the App component
33-
const { currLocation } = tabs[currentTab]; // we destructure the currentTab object
34+
// const [{ tabs, currentTab }, dispatch] = useStoreContext(); // we destructure the returned context object from the invocation of the useStoreContext function. Properties not found on the initialState object (dispatch) are from the useReducer function invocation in the App component
3435
const [sliderIndex, setSliderIndex] = useState(0); // create a local state 'sliderIndex' and set it to 0.
36+
const { tabs, currentTab } = useSelector((state: any) => state.main);
37+
const { currLocation } = tabs[currentTab]; // we destructure the currentTab object
38+
3539

3640
useEffect(() => {
3741
if (currLocation) { // if we have a 'currLocation'

0 commit comments

Comments
 (0)