Relative Content

Tag Archive for javascriptreactjsfrontend

How to fix TranslateX doesn’t work on slider?

const slider = useRef(); let tx = 0; const slideForward = () => { if (tx > -400) { tx -= 100; } slider.current.style.transform = `translateX(`${tx}%`)`; }; const slideBackward = () => {}; return ( <div className=”Customers”> <img src={nextIcon} alt=”” className=”nextIcon” onClick={slideForward} /> <img src={nextIcon} className=”backIcon” alt=”” onClick={slideBackward} /> {customerData.map((record) => ( <div key={record.id} className=”slider”> […]

this challenge concerning state or props or whatever it’s called in React

import React from “react” export default function App() { const [messages, setMessages] = React.useState([“a”, “b”]) /** * Challenge: * – Only display the <h1> below if there are unread messages */ return ( <div> <h1>You have _ unread messages!</h1> </div> ) } this is the code and the challenge commented out, i have no idea […]