File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 1
1
import React , { useState , useEffect } from "react"
2
+ import { useParams } from "react-router-dom"
2
3
import Layout from "../containers/Layout"
3
4
import FeaturesSection from "../components/FeaturesSection"
4
5
import HeroSection from "../components/HeroSection"
@@ -16,13 +17,14 @@ const IndexPage = () => {
16
17
const [ loader , setLoader ] = useState ( true ) ;
17
18
const [ page , setPage ] = useState ( null ) ;
18
19
const [ blogPosts , setBlogPosts ] = useState ( [ ] ) ;
20
+ const { slug } = useParams ( ) ;
19
21
20
22
let menuItems = useMenuItems ( ) ;
21
23
22
24
useEffect ( ( ) => {
23
25
const loadData = async ( ) => {
24
26
try {
25
- const page = await butterCMS . page . retrieve ( "landing-page" , "landing-page-with-components" )
27
+ const page = await butterCMS . page . retrieve ( "landing-page" , slug || "landing-page-with-components" )
26
28
setPage ( page . data . data )
27
29
} catch ( error ) {
28
30
setError ( true )
You can’t perform that action at this time.
0 commit comments