'Programming/react.js'에 해당되는 글 10건

  1. 2019.02.20 react.js 를 node.js 에서 사용하기 예제
  2. 2019.02.10 react.js + bootstrap?
  3. 2019.02.01 react store / flux pattern
  4. 2019.02.01 react.js context, component thru
  5. 2019.01.31 react import {}
  6. 2019.01.29 react html to jsx
  7. 2019.01.28 webpack react
  8. 2019.01.28 react.js tutorial
  9. 2019.01.28 react.js + spring 2
  10. 2019.01.10 react.js 2
Programming/react.js2019. 2. 20. 20:04

react.js로 node.js 상관없이(?) 단독으로 프로젝트 생성해서 하는걸 보다가

node.js 로 생성된 프로젝트에 react.js를 추가하는걸 찾는 중

[링크 : https://github.com/velopert/react-express-hmr-example?files=1]

[링크 : https://velopert.com/1552]


(당연하지만) react 쪽은 javascript로 작성하고

node쪽에서는 단순히 react로 의해 생성되는 bundle.js를 script를 통해 불러오면 끝


react.js는 backend와 연결이 없는 단순 frontend 뷰 엔진이다 보니

그런식으로 구현이 가능 한 듯 하다.

'Programming > react.js' 카테고리의 다른 글

react.js + bootstrap?  (0) 2019.02.10
react store / flux pattern  (0) 2019.02.01
react.js context, component thru  (0) 2019.02.01
react import {}  (0) 2019.01.31
react html to jsx  (0) 2019.01.29
Posted by 구차니
Programming/react.js2019. 2. 10. 22:07

먼가.. 신기한 키워드로 조합이 되었다 -ㅁ-?


[링크 : https://react-bootstrap.github.io/getting-started/introduction/]

[링크 : https://medium.com/@khwsc1/react에-간편하게-bootstrap-4를-달아보자-fdb646904363]

'Programming > react.js' 카테고리의 다른 글

react.js 를 node.js 에서 사용하기 예제  (0) 2019.02.20
react store / flux pattern  (0) 2019.02.01
react.js context, component thru  (0) 2019.02.01
react import {}  (0) 2019.01.31
react html to jsx  (0) 2019.01.29
Posted by 구차니
Programming/react.js2019. 2. 1. 08:15

스터디 중에 store를 쓴다 이런 표현만 해서 찾아 보는 중..


정확하게는(?) 디자인 패턴중 flux 패턴을 변형해서 만든 패턴의 이름으로 "리덕스 패턴" 이고 

해당 모듈은 react-stores 로 구현이 된 듯하다.


어떤 의미로는, 데이터를 물고 물고 물어서 원하는 컴포넌트로 전송해주어야 할 것을

reducer를 이용하여 전송과정을 삭제하고, 바로바로 개별 컴포넌트로 전달할 수 있도록

경로를 연결해주는 것을 자동화 해주는 개념으로도 보여진다.


[링크 : https://velopert.com/3528]

  [링크 : https://velopert.com/reactjs-tutorials]


리덕스 패턴은 MVC 패턴을 대체하기 위해서 페이스북이 사용한 Flux 패턴을 살짝 바꾼 겁니다. 

[링크 : https://www.zerocho.com/category/React/post/57b60e7fcfbef617003bf456]

[링크 : https://engineering.huiseoul.com/react-redux-intro-bbff95b14cdf]


getState()

dispatch(action)

subscribe(listener)

replaceReducer(nextReducer) 

[링크 : https://redux.js.org/api/store]

[링크 : https://www.npmjs.com/package/react-stores]

'Programming > react.js' 카테고리의 다른 글

react.js 를 node.js 에서 사용하기 예제  (0) 2019.02.20
react.js + bootstrap?  (0) 2019.02.10
react.js context, component thru  (0) 2019.02.01
react import {}  (0) 2019.01.31
react html to jsx  (0) 2019.01.29
Posted by 구차니
Programming/react.js2019. 2. 1. 08:12

리액트 컨텍스는 또 무엇인가..


[링크 : https://reactjs.org/docs/context.html]

'Programming > react.js' 카테고리의 다른 글

react.js + bootstrap?  (0) 2019.02.10
react store / flux pattern  (0) 2019.02.01
react import {}  (0) 2019.01.31
react html to jsx  (0) 2019.01.29
webpack react  (0) 2019.01.28
Posted by 구차니
Programming/react.js2019. 1. 31. 19:31

찾으려고 하던 내용

모듈 시스템에 대해 알아보겠습니다. ES2015에서 바뀐 것들 중에서 가장 획기적이라고 생각하는 변화입니다.


첫 번째는 그냥 React인데, 두 번째는 { render }처럼 괄호 안에 감싸져 있네요. 간단한 차이가 있습니다. export 방식의 차이입니다. 모듈을 불러올 때 import라고 써주는 것처럼, 모듈을 다른 파일로 보내려면 export라고 명시적으로 써줘야 합니다. Example.js 파일을 보죠. 

[링크 : https://www.zerocho.com/category/ECMAScript/post/579dca4054bae71500727ab9]



+

요건 JSX에서의 {}의미


{}를 감싸면 프로퍼티나 자식으로 던질수 있다는데 무슨 의미야 -ㅁ-

JavaScript Expressions as Props

You can pass any JavaScript expression as a prop, by surrounding it with {}. For example, in this JSX:


JavaScript Expressions as Children

You can pass any JavaScript expression as children, by enclosing it within {}. For example, these expressions are equivalent:

[링크 : https://reactjs.org/docs/jsx-in-depth.html]

'Programming > react.js' 카테고리의 다른 글

react store / flux pattern  (0) 2019.02.01
react.js context, component thru  (0) 2019.02.01
react html to jsx  (0) 2019.01.29
webpack react  (0) 2019.01.28
react.js tutorial  (0) 2019.01.28
Posted by 구차니
Programming/react.js2019. 1. 29. 19:20

react 에서만 쓰는건 아니겠지만(ECMA 표준일테니)

jsx 라는 녀석.. pug때 처럼 html에서 jsx로 변환해서 쓰는게 편할거 같은데.


문제는.. 이런식으로 구성하게 되면

코드랑 디자인이랑 또 섞이게 되는거 아닌가?...


[링크 : https://transform.now.sh/html-to-jsx/]

[링크 : https://magic.reactjs.net/htmltojsx.htm]

'Programming > react.js' 카테고리의 다른 글

react.js context, component thru  (0) 2019.02.01
react import {}  (0) 2019.01.31
webpack react  (0) 2019.01.28
react.js tutorial  (0) 2019.01.28
react.js + spring  (2) 2019.01.28
Posted by 구차니
Programming/react.js2019. 1. 28. 19:18

import 라고 쓸수 있는게 webpack 덕분이라고 해서 찾아보는 중...

require.js 이런거랑 유사한건가?


[링크 : https://webpack.js.org/]

[링크 : https://velopert.com/3626]



+

별별 유사한 모듈들이 많나보네..

[링크 : https://www.reddit.com/r/javascript/comments/3azxtj/requirejs_vs_browserify_vs_webpack/]

[링크 : https://www.slant.co/versus/3455/11602/~requirejs_vs_webpack]

'Programming > react.js' 카테고리의 다른 글

react import {}  (0) 2019.01.31
react html to jsx  (0) 2019.01.29
react.js tutorial  (0) 2019.01.28
react.js + spring  (2) 2019.01.28
react.js  (2) 2019.01.10
Posted by 구차니
Programming/react.js2019. 1. 28. 18:49


[링크 : https://reactjs.org/tutorial/tutorial.html#setup-for-the-tutorial]

[링크 : https://reactjs.org/docs/create-a-new-react-app.html#create-react-app]

  [링크 : https://github.com/facebook/create-react-app#create-react-app-]

  [링크 : https://github.com/facebook/create-react-app/.../README.md#table-of-contents]



node.js가 깔려있어서 그냥 npx 쳐보니 npx를 설치한다고 시간을 좀 잡아먹고 무언가 뜬다  

C:\Users\User>npx

npx: installed 1 in 5.81s

Path must be a string. Received undefined


ERROR: You must supply a command.


Execute binaries from npm packages.


  npx [options] <command>[@version] [command-arg]...


  npx [options] [-p|--package <package>]... <command> [command-arg]...


  npx [options] -c '<command-string>'


  npx --shell-auto-fallback [shell]



Options:

  --package, -p          Package to be installed.                       [string]

  --cache                Location of the npm cache.                     [string]

  --no-install           Skip installation if a package is missing.    [boolean]

  --userconfig           Path to user npmrc.                            [string]

  --call, -c             Execute string as if inside `npm run-script`.  [string]

  --shell, -s            Shell to execute the command with, if any.

                                                       [string] [default: false]

  --shell-auto-fallback  Generate shell code to use npx as the "command not

                         found" fallback.

                                   [string] [choices: "", "bash", "fish", "zsh"]

  --ignore-existing      Ignores existing binaries in $PATH, or in the local

                         project. This forces npx to do a temporary install and

                         use the latest version.                       [boolean]

  --quiet, -q            Suppress output from npx itself. Subcommands will not

                         be affected.                                  [boolean]

  --npm                  npm binary to use for internal operations.

                                                 [string] [default: "C:\\Program

                             Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js"]

  --node-arg, -n         Extra node argument when calling a node binary.[string]

  --version, -v          Show version number                           [boolean]

  --help, -h             Show help                                     [boolean]


For the full documentation, see the manual page for npx(1).



실수로 오타를 냈는데 myapp 이라는 폴더에 기본 템플릿을 생성하도록 명령어를 실행

그나저나 패키지 받는데 무진장 오래걸리네..

그리고 react 관련해서 명령어들이 꽤나 여러가지 출력된다.

C:\Users\User\Desktop>npx create-react-app myap

npx: installed 1 in 2.423s

Path must be a string. Received undefined

npx: installed 63 in 11.172s

C:\Users\User\AppData\Roaming\npm-cache\_npx\10196\node_modules\create-react-app\index.js


Creating a new React app in C:\Users\User\Desktop\myap.


Installing packages. This might take a couple of minutes.

Installing react, react-dom, and react-scripts...


+ react-dom@16.7.0

+ react@16.7.0

+ react-scripts@2.1.3

added 1926 packages in 197.071s


Initialized a git repository.


Success! Created myap at C:\Users\User\Desktop\myap

Inside that directory, you can run several commands:


  npm start

    Starts the development server.


  npm run build

    Bundles the app into static files for production.


  npm test

    Starts the test runner.


  npm run eject

    Removes this tool and copies build dependencies, configuration files

    and scripts into the app directory. If you do this, you can’t go back!


We suggest that you begin by typing:


  cd myap

  npm start


Happy hacking!

 

[링크 : https://reactjs.org/docs/hello-world.html]



+

2019.01.29


node.js 보다 확실히 구동이 좀 오래걸리네..

그리고 자동으로 등록된 브라우저를 실행해서 띄우는데 이거 끄는 법 없나?

(IE edge를 기본으로 하고 크롬써서..)

D:\work\src\myapp>npm start


> myapp@0.1.0 start D:\work\src\myapp

> react-scripts start

Starting the development server...

Compiled successfully!


You can now view myapp in the browser.


  Local:            http://localhost:3000/

  On Your Network:  http://10.0.0.4:3000/


Note that the development build is not optimized.

To create a production build, use npm run build. 


npm run build로 빌드!

D:\work\src\myapp>npm run build


> myapp@0.1.0 build D:\work\src\myapp

> react-scripts build


Creating an optimized production build...

Compiled successfully.


File sizes after gzip:


  34.71 KB  build\static\js\1.fa92c112.chunk.js

  763 B     build\static\js\runtime~main.229c360f.js

  716 B     build\static\js\main.690c38a1.chunk.js

  512 B     build\static\css\main.659f8df7.chunk.css


The project was built assuming it is hosted at the server root.

You can control this with the homepage field in your package.json.

For example, add this to build it for GitHub Pages:


  "homepage" : "http://myname.github.io/myapp",


The build folder is ready to be deployed.

You may serve it with a static server:


  npm install -g serve

  serve -s build


Find out more about deployment here:


  http://bit.ly/CRA-deploy


npm start로는 개발버전으로 실행되고

serve를 통해서 build 디렉토리 내의 것을 실행해야 static하게 구동이 되는 듯?

그리고 포트가 3000 번에서 5000 번으로 바뀐다.

D:\work\src\myapp>npm install -g serve

C:\Users\user\AppData\Roaming\npm\serve -> C:\Users\user\AppData\Roaming\npm\node_modules\serve\bin\serve.js

+ serve@10.1.1

added 78 packages in 3.909s


D:\work\src\myapp>serve -s build


   ┌───────────────────────────────────────────────┐

   │                                               │

   │   Serving!                                    │

   │                                               │

   │   - Local:            http://localhost:5000   │

   │   - On Your Network:  http://10.0.0.4:5000    │

   │                                               │

   │   Copied local address to clipboard!          │

   │                                               │

   └───────────────────────────────────────────────┘ 


+

윈도우에서는 아래와 같이 set을 통해서 한번 해주면 해당 콘솔창에서는 계속 적용 된다.

D:\work\src\myapp> set BROWSER=none 

D:\work\src\myapp> npm start 


[링크 : https://github.com/facebook/create-react-app/issues/2084]

[링크 : https://stackoverflow.com/questions/51706882/how-do-i-npm-start-with-a-specific-browser]

[링크 : https://github.com/kitze/custom-react-scripts/tree/master/packages/react-scripts#others]

  [링크 : https://github.com/facebook/create-react-app/issues/873]

'Programming > react.js' 카테고리의 다른 글

react import {}  (0) 2019.01.31
react html to jsx  (0) 2019.01.29
webpack react  (0) 2019.01.28
react.js + spring  (2) 2019.01.28
react.js  (2) 2019.01.10
Posted by 구차니
Programming/react.js2019. 1. 28. 10:40

으으으 공부해야 할 것..

회사에서 프로젝트를 angular에서 react로 전환할 거라.. ㅠㅠ


[링크 : https://start.goodtime.co.kr/2018/09/스프링-부트-리액트-개발-셋업-2018/]

'Programming > react.js' 카테고리의 다른 글

react import {}  (0) 2019.01.31
react html to jsx  (0) 2019.01.29
webpack react  (0) 2019.01.28
react.js tutorial  (0) 2019.01.28
react.js  (2) 2019.01.10
Posted by 구차니
Programming/react.js2019. 1. 10. 18:54

회사에서 다른 팀이 react 쓴대서 한번 조사.

그나저나..  typescript 이후로 무언가 변환을 해서 쓰는게 유행인건가..


[링크 : https://velopert.com/3613]

[링크 : https://blog.coderifleman.com/2015/06/23/learning-react-1/]

[링크 : https://www.inflearn.com/course/reactjs-web/]

[링크 : https://www.w3schools.com/whatis/whatis_react.as]


[링크 : https://reactjs.org/]

[링크 : https://devhints.io/react]

'Programming > react.js' 카테고리의 다른 글

react import {}  (0) 2019.01.31
react html to jsx  (0) 2019.01.29
webpack react  (0) 2019.01.28
react.js tutorial  (0) 2019.01.28
react.js + spring  (2) 2019.01.28
Posted by 구차니