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 | 29 | 30 | 31 |
Tags
- createElement
- VAR
- Append
- const
- Let
- boolean
- FOR
- 학습법 #집중력
- createtextnode
- input
- htmlFor
- Openlayers
- appendChild
Archives
- Today
- Total
Atomic Habits
e.target - React vs JavaScript 본문
출처: https://dubaiyu.tistory.com/80 [프론트엔드 여행하려다 풀스택:티스토리]
const onChange = (e) =>{
console.log(e.target)
console.log('e.target.name:'+e.target.name)
console.log('e.target.value:'+e.target.value)
}
...
<input name="username" onChange={onChange} placeholder = "이름"/>
<input name="nickname" onChange={onChange} placeholder = "닉네임"/>
<button onClick={onReset}>초기화</button>
export default function UserList({testest}) {
const [inputs, setInputs] = useState({
username : '',
nickname:''
})
const {username, nickname} = inputs;
const onChange = (e) =>{
// console.log(e.target)
// console.log('e.target.name:'+e.target.name)
// console.log('e.target.value:'+e.target.value)
setInputs({
...inputs,
[e.target.name]:e.target.value
})
}
...
'IT > React' 카테고리의 다른 글
리액트 부트스트랩(Bootstrap) (0) | 2021.11.18 |
---|---|
React. Part2. ch3. 13. Tailwindcss (0) | 2021.11.16 |
[React] MUI - custom SVG Icon 만들기 (0) | 2021.11.15 |
React. Part2. ch3. 10~12. Material UI 1,2,3 (0) | 2021.11.14 |
[VS CODE] React Code Snippets (0) | 2021.11.14 |
Comments