# React Native学习笔记（二）【Hello world】

**URL:** <https://www.shiqidu.com/t/topic/165>\
**Category:** 开发调优\
**Tags:** React-Native\
**Created:** [March 26, 2017, 8:10am UTC](https://www.shiqidu.com/t/topic/165 "2017-03-26T08:10:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leon](https://www.shiqidu.com/user_avatar/www.shiqidu.com/leon/32/5_2.png) [@Leon](https://www.shiqidu.com/u/Leon)\
**Post date:** [March 26, 2017, 8:10am UTC](https://www.shiqidu.com/t/topic/165/1 "2017-03-26T08:10:31Z")

</div>

在确认开发环境全部搭建好以后，我们要干什么呢？当然是输出Hello world了。

![可以通过这些命令确认](https://discourse.shiqidu.com/uploads_nj/article/2017-03-26/58d7721f00d2a.png "可以通过这些命令确认")

**首先初始化一个项目**

命令：

```bash
react-native init luzrn

```

![](https://discourse.shiqidu.com/uploads_nj/article/2017-03-26/58d7732570778.png)

**在安装完成后，我们进入目录`luzrn`，打包生成`index.android.js`。**

![](https://discourse.shiqidu.com/uploads_nj/article/2017-03-26/58d774352448c.png)

然后会生成如下的目录

![](https://discourse.shiqidu.com/uploads_nj/article/2017-03-26/58d77551734a6.png)

**打开index.android.js，添加Hello world**

![添加一句Hello,world](https://discourse.shiqidu.com/uploads_nj/article/2017-03-26/58d775cd6e59b.png "添加一句Hello,world")

然后打开AndroidStudio，打开我们生成的 **android** 目录。同时打开 **genymotion** 模拟器，打开我们的Nexus6p(我的虚拟机器)。

![](https://discourse.shiqidu.com/uploads_nj/article/2017-03-26/58d77647c0feb.png)

**点击AndroidStudio顶部的run，运行项目，模拟器选择genymotion的nexus6p。**

![](https://discourse.shiqidu.com/uploads_nj/article/2017-03-26/58d77694d8f66.png)

如果不出意外，你就能在模拟器的屏幕上看到Hello world了。

![](https://discourse.shiqidu.com/uploads_nj/article/2017-03-26/58d776d91eade.png)
