create-react-app

create-react-app proxy works only with fetch api but not in simple get of the browser

橙三吉。 提交于 2020-05-26 12:53:08
问题 I'm using pretty small create-react-app running on port 3000 setup to proxy requests to backend server running on port 8080. If I put in the browser address bar http://localhost:3000/api/me I get back the index.html page but if I use fetch API to get /api/me it try to call to by backend. The problem is that I have to authenticate with the backend which will set a cookie but since I can't access the login page on http://localhost:3000/login I can't get the cookie. On a different project which

React + backend - project structure when sharing code

别说谁变了你拦得住时间么 提交于 2020-05-25 08:50:21
问题 I really like the folder structure as can be seen here when dealing with a React frontend and a some backend with express: root ├── backend | ├── node_modules | ├── public | ├── src │ │ └── Server.ts | ├── package.json | └── tsconfig.json ├── frontend (created using create-react-app) | ├── node_modules | ├── public | ├── src │ │ └── Index.js | ├── package.json | └── tsconfig.json I think that having separate packages with individual node_modules is reasonable since the frontend and backend

React + backend - project structure when sharing code

余生颓废 提交于 2020-05-25 08:48:12
问题 I really like the folder structure as can be seen here when dealing with a React frontend and a some backend with express: root ├── backend | ├── node_modules | ├── public | ├── src │ │ └── Server.ts | ├── package.json | └── tsconfig.json ├── frontend (created using create-react-app) | ├── node_modules | ├── public | ├── src │ │ └── Index.js | ├── package.json | └── tsconfig.json I think that having separate packages with individual node_modules is reasonable since the frontend and backend

public, src,and scripts folder not created while using create-react-app

廉价感情. 提交于 2020-05-25 06:27:26
问题 I am trying to create a new project using create-react-app using the command given on the docs i.e npx create-react-app my-app but it doesn't contain folders like public src and script . 回答1: Try with these steps : npm rm -g create-react-app npm install -g create-react-app npx create-react-app my-app Source 回答2: For those who keep trying and still doesn't work, you might have the same problem as me. Because the global installs of create-react-app are no longer supported you might have it

public, src,and scripts folder not created while using create-react-app

拈花ヽ惹草 提交于 2020-05-25 06:27:06
问题 I am trying to create a new project using create-react-app using the command given on the docs i.e npx create-react-app my-app but it doesn't contain folders like public src and script . 回答1: Try with these steps : npm rm -g create-react-app npm install -g create-react-app npx create-react-app my-app Source 回答2: For those who keep trying and still doesn't work, you might have the same problem as me. Because the global installs of create-react-app are no longer supported you might have it

How can I develop locally using a domain name instead of 'localhost:3000' in the url with create-react-app?

痴心易碎 提交于 2020-05-23 10:47:21
问题 I have been developing a small app with create-react-app and a few other libraries i added. Given the planned architecture and some tests i'd like to run with react-router, i would like to be able to run my app locally using a domain mame in the url, so that instead of localhost:3000/ it would be somedomain.com I have tried a few things like ejecting ceate-react-app but im not sure how to modify the webpack config to change the public path, or how to set up some sort of proxy on my machine so

How can I develop locally using a domain name instead of 'localhost:3000' in the url with create-react-app?

安稳与你 提交于 2020-05-23 10:46:49
问题 I have been developing a small app with create-react-app and a few other libraries i added. Given the planned architecture and some tests i'd like to run with react-router, i would like to be able to run my app locally using a domain mame in the url, so that instead of localhost:3000/ it would be somedomain.com I have tried a few things like ejecting ceate-react-app but im not sure how to modify the webpack config to change the public path, or how to set up some sort of proxy on my machine so

Error installing create-react-app with npm

本秂侑毒 提交于 2020-05-17 09:51:32
问题 When I try to install create-react-app (or nodemon) globally or even within a project, I get the following error. However, I can install other packages perfectly fine both globally and locally. I think it has something to do with the fact that both create-react-app and nodemon are run from the terminal rather than used within a project's code. I have already tried reinstalling nodejs and opening the terminal as administrator, but that did not work. $ npm i -D nodemon npm ERR! path C:\Users

In React, how to prevent a component's CSS import from applying to the entire app?

心已入冬 提交于 2020-05-15 01:47:33
问题 I'm using facebook's create-react app for my application: In my Login.js container, I am importing CSS like so: import React from 'react'; import '../../styles/users/Login.css' const Login = () => { .... The problem is the Login.css styles are being applied to my entire application... for example, if Login.css has: body { background:Red ; } The entire app would have a body of background: Red; Even outside of the Login container. What I expected/want is for a CSS import within a container to

In React, how to prevent a component's CSS import from applying to the entire app?

末鹿安然 提交于 2020-05-15 01:45:01
问题 I'm using facebook's create-react app for my application: In my Login.js container, I am importing CSS like so: import React from 'react'; import '../../styles/users/Login.css' const Login = () => { .... The problem is the Login.css styles are being applied to my entire application... for example, if Login.css has: body { background:Red ; } The entire app would have a body of background: Red; Even outside of the Login container. What I expected/want is for a CSS import within a container to