Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReactJS app doesn't work on mobile

I deployed my app to heroku, and it works perfectly on desktop, but it seems like bundle.js doesn't start on mobile, it stacks on preloader. I used React + Redux, react-router. fetch requests I have replaced with axios, but it still doesn't work. Who has such an experience or knows how to debug website on mobile, get console logs?

Update

also doesn't work in Firefox. It logs that 'r' in undefined in minimized script. seems like webpack do something wrong in minimizing. suspiciously works in chrome...

Update 2

Don't forget to delete redux dev debugger when deploying your apps :)

like image 846
Alexanderswed Avatar asked Dec 26 '16 15:12

Alexanderswed


People also ask

Do React apps work on mobile?

React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces. Use a little—or a lot. You can use React Native today in your existing Android and iOS projects or you can create a whole new app from scratch.

How do I run a React app on my phone?

To install React, We have to install nodejs and npm first but before that let's update all available packages in our system. Now clear the termux screen with clear command or create a new session. Update all the packages and dependencies installed on the system with this command. This will install both nodejs and npm.

Can React apps run on Android?

In order to run React Native apps on Android, you need an Android device or an emulator. If you have an Android phone or tablet, simply plug it in. You might need to enable USB debugging in Device Settings, under Developer Tools. Follow the official Android documentation if you run into any issues.

Is React mobile friendly?

Tricks to keep your React site Mobile Friendly. React provides to your Frontend a Simple, Stateless & Declarative Component architecture that keeps your app easy to understand and extend as it grows from 20 to 20,000+ lines of code.


1 Answers

It looks like your app breaks in browsers that don't have "Redux DevTools Extension" installed.

According to the documentation your store setup should look like this:

import { createStore, applyMiddleware, compose } from 'redux';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(reducer, preloadedState, composeEnhancers(
  applyMiddleware(thunk)
));

In your code you are not using the customised compose function returned from the extension.

like image 134
Ashley 'CptLemming' Wilson Avatar answered Sep 26 '22 06:09

Ashley 'CptLemming' Wilson