I am using react wrapper for intro.js. I am trying to integrate it in functional component. The steps are working fine, but the intro.js is not correctly identifying the elements provided in the steps. I have tried defining the elements with document.getElementById() and also with document.querySelector().Nothing seems to work. Is there any other way?
import React,{useState} from 'react'
import { Steps, Hints } from "intro.js-react";
import "intro.js/introjs.css"
import "intro.js/themes/introjs-nassim.css";
const AppIntro = () =>{
const [stepsEnabled, setStepsEnabled] = useState(false)
const [initialStep, setInitialStep] = useState(0)
const [steps, setSteps] = useState([
{
intro:"Welcome to our application",
position: 'top'
},
{
element:document.getElementById('.card'),
intro: 'This is the second step',
position: 'left'
},
{
element: document.querySelector('.tableRow'),
intro:'This is the third step',
position: 'top'
}
])
const onExit = () =>{
setStepsEnabled(false);
}
const startIntro=()=>{
setStepsEnabled(true)
}
return(
<div>
<button onClick={()=>startIntro()}>Click me</button>
<Steps
enabled={stepsEnabled}
steps={steps}
initialStep={initialStep}
onExit={onExit}
options=
{{
tooltipClass: 'customTooltip',
showProgress: true,
showStepNumbers: true,
showBullets: false,
exitOnOverlayClick: false,
doneLabel: "Done",
nextLabel: "Next",
hideNext: false,
}}
/>
</div>
)
} export default AppIntro
This is my component