react-yelp-clone

教程:构建一个 Yelp 克隆。(Tutorial: Build a Yelp-clone in React.)

  • 所有者: fullstackreact/react-yelp-clone
  • 平台: Linux, Mac, Windows
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

React Tutorial:构建一个 Yelp 克隆

tl;dr —— 这是我们博客文章的代码,它将指导您构建一个完整的 React 应用程序,即使您在框架中几乎没有经验。我们要在React中创建一个 Yelp 克隆。

请参阅 演示 and 随附的博客文章

让我们使用 React 构建一个 Yelp 的轻量级克隆。

在本教程中,我们将讨论:

  • 如何从头开始设置新的 React 项目
  • 如何创建一个基本的 React 组件
  • 如何使用 postcss 编写模块化 CSS
  • 如何设置测试
  • 如何使用 react-router 路由到不同的页面
  • 如何与 Google 地图集成
  • 如何编写 Google Maps React 组件
  • 如何写一个五星评级组件

我们将把 React 的很多不同的部分捆绑在一起,以构建一个完整大小的 React 应用程序。 这篇文章将指导您构建一个完整的 React 应用程序,即使你在框架中几乎没有经验。

快速开始

首先,克隆存储库

git clone https://github.com/fullstackreact/react-yelp-clone.git react-yelp-clone
cd react-yelp-clone

# install the dependencies
npm install

# copy configuration (see below)
cp .env.example .env

# start the server
npm start

配置应用程序

此应用程序使用 dotenv 进行配置。 要为您自己的 api 访问配置应用程序,请在此处从 Google 获取 api 令牌,并将其设置在根目录下名为 .env 的文件中,以获取名为 __GAPI_KEY__ 的密钥。 例如,假设您的 gapi 键是:abc123。 您的.env文件应如下所示:

GAPI_KEY=abc123

您还可以通过复制根目录下的 .env.example 文件来创建此文件:

cp .env.example .env

启动应用程序

npm install 
npm start

我们将使用的库

此应用程序使用以下技术:

运行测试

该应用程序使用测试构建,包括奇妙的 enzymechai 库。 要运行测试,请使用npm测试脚本:

npm run test

查看博客文章,了解有关如何构建此应用程序的更多信息,以及使用 React 构建自己的应用程序的完整教程。

贡献

git clone https://github.com/fullstackio/yelp-clone.git yelp
cd yelp
npm install
npm start

Fullstack React Book

这个应用程序是与博客文章 React Tutorial: Cloning Yelp 一起构建的。

这个仓库是由 Fullstack React 团队编写并维护的。 在本书中,我们涵盖了更多这样的项目。 我们遍历每行代码,解释它为什么存在以及它是如何工作的。

这个应用程序只是我们书中的几个应用程序之一。 如果您正在学习 React,那么没有比使用 Fullstack React 书花几个小时更快的方法了。

概覽

名稱與所有者fullstackreact/react-yelp-clone
主編程語言JavaScript
編程語言JavaScript (語言數: 3)
平台Linux, Mac, Windows
許可證MIT License
發布數0
創建於2016-05-20 00:54:57
推送於2021-10-24 11:29:23
最后一次提交2016-08-05 20:58:03
星數837
關注者數27
派生數223
提交數23
已啟用問題?
問題數26
打開的問題數10
拉請求數4
打開的拉請求數0
關閉的拉請求數0
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

React Tutorial: Build a Yelp Clone Dolpins

tl;dr - This is the code for our blog post which will guide you through building a full React app, even with little to no experience in the framework. We're going build a Yelp clone in React

See the demo and accompanying blog post.

Let's build a lightweight clone of Yelp using React.

In this tutorial we'll talk about:

  • How to setup a new React project from scratch
  • How to create a basic React component
  • How to write modular CSS using postcss
  • How to setup testing
  • How route to different pages with react-router
  • How to integrate with Google Maps
  • How to write a Google Maps React component
  • How to write a five-star rating component

We'll be tying in a lot of different pieces of React together to build a full-sized React app. This post will guide you through building a full React app, even with little to no experience in the framework.

Quickstart

First, clone the repository:

git clone https://github.com/fullstackreact/react-yelp-clone.git react-yelp-clone
cd react-yelp-clone

# install the dependencies
npm install

# copy configuration (see below)
cp .env.example .env

# start the server
npm start

Configuring the Application

This app uses dotenv for configuration. In order to configure the application for your own api access, grab an api token from Google here and set it in a file called .env at the root for a key called __GAPI_KEY__.
For instance, say that your gapi key is: abc123. Your .env file should look like:

GAPI_KEY=abc123

You can also create this file by copying the .env.example file at the root:

cp .env.example .env

Starting the Application

npm install 
npm start

Libraries We'll Use

This app uses the following technologies:

Running the Tests

The application is built using tests, including the fantastic enzyme and chai libraries. To run the tests, use the npm test script:

npm run test

Check out the blog post for more information on how this app was built and a complete tutorial on using React to build your own apps.

Contributing

git clone https://github.com/fullstackio/yelp-clone.git yelp
cd yelp
npm install
npm start

Fullstack React Book

This app was built alongside the blog post React Tutorial: Cloning Yelp.

This repo was written and is maintained by the Fullstack React team. In the book we cover many more projects like this. We walk through each line of code, explain why it's there and how it works.

This app is only one of several apps we have in the book. If you're looking to learn React, there's no faster way than by spending a few hours with the Fullstack React book.

License

MIT

去到頂部