{"id":20709735,"url":"https://github.com/quadflask/facebook-react-tut","last_synced_at":"2026-03-07T23:32:06.549Z","repository":{"id":35792088,"uuid":"40073228","full_name":"QuadFlask/facebook-react-tut","owner":"QuadFlask","description":null,"archived":false,"fork":false,"pushed_at":"2015-08-02T09:00:04.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-13T14:46:08.365Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QuadFlask.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-02T08:18:55.000Z","updated_at":"2015-08-02T08:20:00.000Z","dependencies_parsed_at":"2022-09-05T11:00:42.334Z","dependency_job_id":null,"html_url":"https://github.com/QuadFlask/facebook-react-tut","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/QuadFlask/facebook-react-tut","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadFlask%2Ffacebook-react-tut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadFlask%2Ffacebook-react-tut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadFlask%2Ffacebook-react-tut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadFlask%2Ffacebook-react-tut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QuadFlask","download_url":"https://codeload.github.com/QuadFlask/facebook-react-tut/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadFlask%2Ffacebook-react-tut/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30237329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T23:24:20.706Z","status":"ssl_error","status_checked_at":"2026-03-07T23:21:10.486Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T02:08:02.078Z","updated_at":"2026-03-07T23:32:06.524Z","avatar_url":"https://github.com/QuadFlask.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# facebook-react-tut\ntut: [https://facebook.github.io/react/docs/tutorial.html](https://facebook.github.io/react/docs/tutorial.html)\n\n* JSX : Js 에 Xml 문법 같이 사용할 수 있도록. -\u003e Js 로 다시 트랜스파일해주는 트랜스 파일러가 필요함(JSXTransformer.js)\n\n\u003e 실행: \n\u003e ```\n\u003e python -m SimpleHTTPServer\n\u003e open http://localhost:8000/index.html\n```\n\n### 1. 태그 만들기\n\n```js\nvar CommentForm = React.createClass({\n\trender: function(){\n\t\treturn (\n\t\t\t\u003cdiv className=\"commentForm\"\u003e\n\t\t\t\tHello, world! I am a Commentform.\n\t\t\t\u003c/div\u003e\n\t\t\t);\n\t}\n});\n```\n\u003e 이렇게 커스텀 태그를 정의 할 수 있고 다른곳에서도 써먹 을 수 있다.\n\n### 2. html에 붙이기\n```js\nReact.render(\n\t\u003cCommentBox/\u003e,\n\tdocument.getElementById('content')\n);\n```\n\u003e 랜더링할 태그를 적고, 2번째 인자로 어디다가 붙일지 찾아서 넣는다.\n\n### 3. 태그에 데이터 넘겨주기\n\n```js\nReact.render(\n\t\u003cCommentBox data={data}/\u003e,\n\tdocument.getElementById('content')\n);\n```\n\u003e 태그의 애트리뷰트로 넘겨주면 되는데, 받는 태그(클래스?)에선 this.props 로 접근해서 찾아오면 된다.\n\n### 4. 폼 엑션 이벤트 발생 오버라이드하기\n```js\nhandleSubmit: function(e){\n\te.preventDefault();\n\tvar author = React.findDOMNode(this.refs.author).value.trim();\n\tvar text = React.findDOMNode(this.refs.text).value.trim();\n\tif(!text || !author){\n\t\treturn;\n\t}\n\tthis.props.onCommentSubmit({author: author, text:text});\n\tReact.findDOMNode(this.refs.author).value = '';\n\tReact.findDOMNode(this.refs.text).value = '';\n\treturn;\n},\n```\n\u003e `e.preventDefault();` 로 기본 이벤트를 없애고.. `onCommentSubmit` 프로퍼티에 데이터를 넘겨준다.\n\u003e 이렇게 넘긴 데이터를,\n\n```js\nrender: function() {\n\t\t\t\treturn (\n\t\t\t\t\t\u003cdiv className=\"commentBox\"\u003e\n\t\t\t\t\t\t\u003ch1\u003eComments\u003c/h1\u003e\n\t\t\t\t\t\t\u003cCommentList data={this.state.data}/\u003e\n\t\t\t\t\t\t\u003cCommentForm onCommentSubmit={this.handleCommentSubmit}/\u003e\n\t\t\t\t\t\u003c/div\u003e\n\t\t\t\t\t);\n\t\t\t}\n```\n\u003e CommentBox 클래스에서 이벤트로 받아다가 `handleCommentSubmit` 함수를 실행한다.\n\u003e on ~ 이렇게 하면 다른곳에서 데이터가 변경?실행? 되었을때를 리스닝할 수 있는듯...\n\u003e\u003e 참고로, comments.json 에 작성하는 프로세스가 없으니 코맨트 작성이 안된다...\n\n### 5. 최적화 - optimistic updates\n\n\u003e submit을 하면 일단 데이터를 뷰에도 뿌려준다.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquadflask%2Ffacebook-react-tut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquadflask%2Ffacebook-react-tut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquadflask%2Ffacebook-react-tut/lists"}