"use client" import { useState, useEffect } from "react" import Link from "next/link" import JavaText from "./java_tutorial.json" export default function Component() { const JavaContent = JavaText const [showButton, setShowButton] = useState(false) useEffect(() => { const handleScroll = () => { if (window.scrollY > 300) { setShowButton(true) } else { setShowButton(false) } } window.addEventListener("scroll", handleScroll) return () => { window.removeEventListener("scroll", handleScroll) } }, []) const scrollToTop = () => { window.scrollTo({ top: 0, behavior: "smooth" }) } return (
{JavaContent.sections.map((section, index) => (

{section.title}

{section.description}

{section.items.map((item, itemIndex) => (

{item.title}

{item.description}

                                                {item.code}
                                            

{item.explanation}

))}
))}
{showButton && ( )}
) }