I'm a beginner of react please help to resolve this issues
Gate.js
function sendData(send) {
props.setGet(send);
}
...
<SwiperSlide id='slide01'>
{({ isActive }) => (
<div className='nav_title'>
{ isActive === true ? sendData("1") : null}
...
</div>
)}
</SwiperSlide>
}
Apps.js
const [get, setGet] = useState('');
...
<Gate setGet={setGet}/>
<Contents value={get}/>
...
Contents.js
const value = props.value;
...
<div className='contents'>
{value === "1" ? <div className='show_animation'><Offers/></div> : null}
{value === "2" ? <div className='show_animation'><Booking/></div> : null}
{value === "3" ? <div className='show_animation'><About/></div> : null}
{value === "4" ? <div className='show_animation'><Guide/></div> : null}
</div>
...
I wanna make like this
enter image description here
2 pages connecting automatically
setGetdirectly in the component markup, that causes a state update every time the component renders. You should enclose thatsetGetcall in an event handler, and attach it to something like anonClick. If you can provide more context on what is that you're intention is with that setGet call I could elaborate an answer