CLASS
[React.js] state가 undefined일 때 - this 바인딩
this는 자신이 속한 객체 또는 자신이 생성할 인스턴스를 가리키는 자기 참조 변수이다. this를 통해 자신이 속한 객체 또는 자신이 생성할 인스턴스의 프로퍼티나 메서드를 참조할 수 있다. 배경 boostcamp AI Tech 1기에 참여하여 팀 프로젝트로 리액트 앱을 개발한 적이 있었다. CSV 형태의 평가 데이터를 입력하면 그에 따른 모델 예측 결과를 이미지로 확인하는 애플리케이션이었다. 사용자가 CSV 파일을 입력하고 전송 버튼을 클릭하면 즉시 로딩 화면(스피너)이 보이면서 모델 서버에 요청을 보내게 된다. 서버로부터 응답을 받고 나면 상태 변화에 따라 예측 결과를 화면에 보여준다. render 메서드의 초기 화면(CSV input, button) render() { const { isLoadin..
You can not write Java code without defining a class.
좀 뜬금없지만, 클래스 없이 자바를 쓸 수 있을까...? 🤔 Yes, you need at least one class to have a program, but no, you do not need any methods (contrary to some other answers). The reason you need a class is because in Java, all code is inside classes. So to have any code, you need a class. However, code doesn't necessarily need to be in a method. It can also be in initializers. So, here is a complete Java progr..
[Swift] 스위프트 Class vs Struct
🤔 Swift의 Class와 Struct를 비교해보자. ✔️ Class - Enemy.swift class Enemy { var health: Int var attackStrength: Int init(health: Int, attackStrength: Int) { self.health = health self.attackStrength = attackStrength } func takeDamage(amounts: Int) { self.health -= amounts } func move() { print("Walk forwards.") } func attack() { print("Land a hit, does \(attackStrength) damage.") } } - main.swift let zom..