목록2024/06 (14)
훈돌라
오류를 수정하려면 hide 속성을 boolean 대신 문자열로 전달해야 한다. 이를 위해 조건부 렌더링하는 곳에서 hide 속성을 문자열로 변환하여 전달하면 된다. display 속성은 boolean이 아니라 문자열을 받아야 한다고 함. HomeInput에서 검색어 상태 관리: HomeInput에서 검색어를 입력할 때마다 상태를 업데이트const HomeInput = ({ onSearch }) => { const [showInput, setShowInput] = useState(false); const [searchFeed, setSearchFeed] = useState(''); const toggleInput = () => { setShowInput(!showInput);..
돋보기 이미지 토글 시 검색창 활성화 const SearchInput = styled.input` padding: 10px; font-size: 1rem; border: 3px solid #343434; border-radius: 5px; width: 300px; display: ${(props) => (props.show ? 'block' : 'none')};`; const HomeInput = () => { const [showInput, setShowInput] = useState(false); const toggleInput = () => { setShowInput(!showInput); }; return ( InputImage src={inputima..