2

I'm currently developing a website using React Native, when I read about React Native I got the info that React Native can be used as both a web application and a mobile application, so I tried it.

Currently, my website is finished and can be run on localhost

but right now I have a problem when I want to host the website using Cpanel.

Previously I wanted to ask, can React Native be hosted as a website?

SanMargo
  • 33
  • 1
  • 6
  • make build of your react native web. It will generate static website. which you can host on cpanel as normal web – Muhammad Iqbal Aug 19 '20 at 19:28
  • Can you show me how to build this? Because in mine it just shows the code in index.js instead of my app. I have tried to follow this tutorial https://dev.to/crishanks/deploy-host-your-react-app-with-cpanel-in-under-5-minutes-4mf6 but still, it just shows index.js – SanMargo Aug 20 '20 at 05:19
  • can you share your project with sandbox or snack ? – Muhammad Iqbal Aug 20 '20 at 05:36
  • do you mean this? https://codesandbox.io/s/github/devincalmt/contoh_project – SanMargo Aug 20 '20 at 11:43
  • That is part of my project. Should I add node_modules? I never used sandbox before – SanMargo Aug 20 '20 at 11:43

1 Answers1

3

Run Following command in your project

 expo build:web

it will generate web-build folder. inside build folder all your static, assets, js and html files are located.

  • now its time to upload you static file to c-panel

open your c-panel account and go file manager and select your domain where you want to go live with web-build (react-native-web).

Upload web-build's folder content to your it will take few minuts and you can visit your domain your site will be live on specific domain

Muhammad Iqbal
  • 1,394
  • 1
  • 14
  • 34