React 新手要會的安裝步驟及指令

React 是目前前端框架中,學習曲線最長的前端框架語言,由 Facebook 開發, 但不可否認,當要做中大型專案開發時,他能避免過去開發上遇到的問題。

學習 React 之時,大多是人會先去看官方文件,然後…會發現官方文件其實並沒又對細節做很多描述,對於剛觸碰的新手,簡直可以用是天書來形容。所以這邊簡單介紹一下如何安裝 React。

React 環境安裝

在安裝 React 之前,你需要先安裝他的相關環境,最簡單的方式執行 npm install,如果你想問 npm 到底是甚麼,可以看一下 維基百科 NPM,這裡面有簡單對 npm 作介紹。

npm install


安裝好 npm 後,接著先進入到你要開發的資料夾,使用指令建立 React 專案,使用方法如下 :

建立 React 專案

npx create-react-app 你的專案名稱(請使用英文) 


安裝好 React 專案後,進入你開好的專案中,執行 npm start 來啟動 React

npm start

React 預設開發 localhost:3000,如果想要更改可以到設定檔中更改。到這邊,只要你網頁能跑出來,基本上你已經可以開始著手開發 React。


想要測試 React 在開發中是否有作物,可以使用以下指令進行測試。

npm test

運行建構( React 程式封裝 )

當你覺得你開發的差不多了,就可以執行以下指令,對 React 進行封裝。

npm rum build

45 留言

  1. Do you mind if I quote a couple of your posts as long as I provide credit and sources back to
    your site? My blog is in the very same niche as yours and
    my users would genuinely benefit from a lot of
    the information you provide here. Please let me
    know if this ok with you. Appreciate it!

  2. Remarkable things here. I am very happy to peer your article.
    Thanks so much and I’m looking forward to touch you. Will you please drop me a e-mail?

  3. Hey there! I know this is kind of off topic but I was wondering which blog platform are you using for this website?
    I’m getting fed up of WordPress because I’ve had problems
    with hackers and I’m looking at options for another platform.
    I would be awesome if you could point me in the direction of a good platform.

    • 文章作者的留言

      I currently use wordpress.org, because I can manage the server, so I don’t have to worry about being hacked.
      If you need my advice, I can provide the following two beginners who are easier to learn
      1. wordpress.com
      2. wix.com

      The above two paid versions can reduce the situation of being hacked

  4. Hi there I am so grateful I found your weblog, I really found you by mistake, while I was browsing on Digg for something else, Anyways I am here now and would just
    like to say thank you for a marvelous post and a all round interesting blog
    (I also love the theme/design), I don’t have time to read it all at the
    minute but I have book-marked it and also added in your RSS feeds, so when I have time I will be back to read a great deal more,
    Please do keep up the excellent work.

  5. Write more, thats all I have to say. Literally, it
    seems as though you relied on the video to make your point.

    You definitely know what youre talking about, why throw away your
    intelligence on just posting videos to your blog when you could be giving us something informative to

    • 文章作者的留言

      Hi access35,Thank you very much for your message.
      I will continue to add related content.
      The content here is my past work experience.

      But I just started blogging.
      Which topic to write first has always been my current headache.

      If you have any topics or questions you want to know, please let me know.

  6. Hmm it looks like your website ate my first comment (it was super long) so I guess I’ll just sum it up what
    I had written and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog writer but I’m still new to the whole thing.
    Do you have any tips for newbie blog writers?
    I’d really appreciate it.

  7. My spouse and I stumbled over here from a different web page and thought I
    might check things out. I like what I see so now i am following you.
    Look forward to checking out your web page repeatedly.

    • 文章作者的留言

      You are welcome to visit and I am honored to be able to see it.
      If you have any questions you want to see or understand, please leave a message, and I will continue to work hard to provide useful content.

  8. This paragraph offers clear idea designed for the new users
    of blogging, that really how to do blogging.

  9. Good post. I learn something new and challenging on websites I stumbleupon every day.
    It’s always useful to read through articles from other authors and practice a little something from other websites.

  10. Hey would you mind letting me know which hosting company you’re using?

    I’ve loaded your blog in 3 different browsers and I must say this blog loads a lot faster then most.
    Can you recommend a good hosting provider at a fair price?
    Many thanks, I appreciate it!

    • 文章作者的留言

      I did not use an external hosting company, but rented a blank Linux space and set it up by myself.

      After installation, I also adjusted the loading speed.
      The result is what you see. Actually it could be faster~
      But due to the cost, I made a choice, but I am very satisfied with the result.

    • 文章作者的留言

      If you need it, you can tell me and we can talk.
      I also rent out to other users.

  11. Hello just wanted to give you a quick heads up. The
    words in your post seem to be running off the screen in Safari.

    I’m not sure if this is a formatting issue or something to do with internet browser compatibility
    but I thought I’d post to let you know. The style and design look
    great though! Hope you get the issue solved soon. Thanks

    • 文章作者的留言

      thank you very much.
      Your suggestions are very useful to me.
      I will take time to test and correct them.
      If there are other suggestions or findings, please feel free to let me know.

  12. In fact no matter if someone doesn’t be aware of then its up to other users that they
    will assist, so here it happens.

  13. Hi there, You have done an incredible job. I’ll certainly digg
    it and personally suggest to my friends. I am sure they will be benefited
    from this website.

  14. Actually no matter if someone doesn’t be aware of afterward
    its up to other visitors that they will help, so here it happens.

  15. Awesome! Its actually awesome post, I have got much clear idea about from this post.

  16. Marvelous, what a web site it is! This webpage provides helpful information to us, keep
    it up.

  17. Heya are using WordPress for your site platform?
    I’m new to the blog world but I’m trying to get started
    and create my own. Do you need any html coding knowledge to make your own blog?
    Any help would be really appreciated!

  18. I used to be able to find good advice from your content.

  19. Simply want to say your article is as astounding. The clarity in your
    post is simply spectacular and i could assume you’re an expert on this
    subject. Fine with your permission allow
    me to grab your RSS feed to keep updated with forthcoming
    post. Thanks a million and please keep up the gratifying work.

  20. Greetings! Very useful advice in this particular post!
    It’s the little changes that make the largest changes. Many
    thanks for sharing!

  21. Howdy would you mind stating which blog platform you’re using?
    I’m planning to start my own blog soon but I’m having a hard
    time choosing between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most blogs and I’m looking for something completely unique.
    P.S My apologies for being off-topic but I had to ask!

    • 文章作者的留言

      This question is a good question.
      I will reply to you based on my past experience in handling cases.
      hope it helps you.

      First, you must know what to write? What kind of feeling do you want to express?
      This will help you initially filter out some platform tools

      The following is the introduction of BlogEngine / WordPress / B2evolution / Drupal and its suitable uses:

      BlogEngine: It seems that BLOG can be set up (Google data is less, the cost of solving problems is high)
      WordPress: Suitable for creating personal portfolios, official websites, blogs, event pages or news. Some packages support shopping carts or forums.
      B2evolution: suitable for building blogs, event pages or information line websites. (Google has less data and the cost of solving problems is high)
      Drupal: suitable for building blogs and forums (old brand, but because the setup is more cumbersome, people with technical background must be able to get started)

      You need to know that any software is just a tool.
      You should choose a platform that can help you get started quickly.

      Just like me, I have the ability to develop cms by myself, but I still choose to use WordPress.
      The entry time is very short, and I can spend time on important content production.

      If you want to get started quickly, I suggest you try
      wordpress.com, Strikingly, weebly, wix

      If you want to set it up during the maintenance and development process, the flexibility of WORDPRESS.ORG will be a good choice (this is my current plan)

  22. very good post