250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 자료구조
- 클린코드
- vue.js
- AWS
- 자바스터디
- 스프링부트와AWS로혼자구현하는웹서비스
- CleanCode
- 혼공SQL
- 인덱스
- 자바예외
- 알고리즘분석
- aop
- 이펙티브 자바
- 인프런백기선
- SQL쿡북
- jpa
- 네트워크
- 도메인 주도 개발 시작하기
- java
- MariaDB
- 인프런김영한
- react
- AWS RDS
- 자바
- 기술면접
- 이팩티브 자바
- DDD
- 알고리즘
- mysql
- 이펙티브자바
Archives
- Today
- Total
기록이 힘이다.
React 카카오(Daum) 주소 찾기 API 사용하기 본문
728x90
import DaumPostcode from 'react-daum-postcode';

const [address, setAddress] = useState(""); // 우편번호
const [detailaddress, setDetailaddress] = useState(""); //api상의 주소
const [detail2address, setDetail2address] = useState(""); //상세주소
const {addDocument, response } = useFirestore('manmul');
const [openPostcode, setOpenPostcode] = useState(false); //카카오api


/**
* 카카오api handle
*/
const clickButton =() =>{
setOpenPostcode(current => !current);
}
const selectAddress = (data) => {
console.log(`
주소: ${data.address},
우편번호: ${data.zonecode}
`)
setAddress(data.zonecode);
setDetailaddress(data.address);
setOpenPostcode(false);
}
<tr><td className="title">주소</td>
<input id="address_kakao"
onClick={clickButton}
value={address}
></input>
{openPostcode &&
<DaumPostcode
onComplete={selectAddress} // 값을 선택할 경우 실행되는 이벤트
autoClose={false} // 값을 선택할 경우 사용되는 DOM을 제거하여 자동 닫힘 설정
defaultQuery='판교역로 235' // 팝업을 열때 기본적으로 입력되는 검색어
/>}
<td className="title">상세주소</td>
<td><input value={detailaddress}></input></td>
<input value={detail2address}
onChange={(e)=>{ setDetail2address(e.target.value)}}
></input>
</tr>
reference
https://developers.kakao.com/docs/latest/ko/local/dev-guide
Kakao Developers
카카오 API를 활용하여 다양한 어플리케이션을 개발해보세요. 카카오 로그인, 메시지 보내기, 친구 API, 인공지능 API 등을 제공합니다.
developers.kakao.com
https://myhappyman.tistory.com/240
카카오(Daum) 주소 찾기 API 사용하기
카카오 주소🏠 찾기 API https://postcode.map.daum.net/guide Daum 우편번호 서비스 우편번호 검색과 도로명 주소 입력 기능을 너무 간단하게 적용할 수 있는 방법. Daum 우편번호 서비스를 이용해보세요. 어
myhappyman.tistory.com
[React] 카카오 주소 검색 사용하기
안녕하세요. J4J입니다. 이번 포스팅은 카카오 주소 검색 사용하는 방법에 대해 적어보는 시간을 가져보려고 합니다. 주소 검색 사용 방법 [ 1. 패키지 설치 ] $ npm install react-daum-postcode [ 2. 주소 컴
jforj.tistory.com
'React' 카테고리의 다른 글
[React] checkbox에서 하나만 선택 (0) | 2023.02.01 |
---|---|
[React] 다른 함수에 있는 요소 불러오기 (0) | 2023.01.31 |
input in table (테이블 안에 input 박스 선 제거) (0) | 2023.01.30 |
useState vs useReducer (0) | 2023.01.30 |
react-router-dom v6 업데이트 후 달라진 점 export 'withRouter' (imported as 'withRouter') was not found in 'react-router-dom' (0) | 2023.01.17 |