전체 글 70

React-Class Ajax

React를 통한 간단한 AJAX 코드 //fetch호출이 시작되는 public폴더에 list.json과 1, 2, 3 파일명의 json을 저장 class Nav extends Component { state = { list:[] } componentDidMount() { fetch('list.json') .then(function(result){ return result.json(); }) .then(function(json){ this.setState({list:json}); }.bind(this)) } render(){ var listTag = []; for(var i=0; i json으로 converting }) .then(function(json){ // 첫번째 then의 return value..

카테고리 없음 2023.04.01