Archives : February-2021

I’m having some difficulty running full test coverage from a script in the package.json of my create-react-app. Link to repo here; package.json { "name": "React Kitchen Sink", … "dependencies": { … "react": "^16.14.0", "react-dom": "^16.14.0", "react-scripts": "^3.4.4" }, "scripts": { "start": "react-scripts -r @cypress/instrument-cra start", "start:silent": "BROWSER=none yarn start", "start:server": "start-server-and-test start:silent http://localhost:3000", "build": "react-scripts ..

Read more

I have a Django app that’s using corsheaders package and its in settings.py like this: INSTALLED_APPS = [ …, corsheaders, …] … MIDDLEWARE = [     # on top     "corsheaders.middleware.CorsMiddleware",     "django.middleware.common.CommonMiddleware",     … ] … CORS_ORIGIN_ALLOW_ALL = True CORS_ALLOW_CREDENTIALS = True When I’m trying to do a PATCH request ..

Read more

When I use class component, I have code: setTimeout(() => console.log(this.state.count), 5000); When I use hook: const [count, setCount] = useState(0); setTimeout(() => console.log(count), 5000); If I trigger setTimeout then change the count to 1 before the timeout (5000ms), class component will console.log(1) (the newest value), and for useState it is console.log(0) (value when register ..

Read more

I’m trying to get a list of available Bluetooth devices using this example. (I don’t use emulators, I’ve connected the phone via USB.) This is an official example of the code. Code is here However, I can’t see any devices. The event ‘handleDiscoverPeripheral’ is never triggered. I should be able to see at least 2 ..

Read more

I am using Expo Camera to take some user pictures for a profile form. What is happening is when I try to set camera’s ref to a state it crashes and throw the following error. Couldn’t find a navigation context. Have you wrapped your app with ‘NavigationContainer’? See https://reactnavigation.org/docs/getting-started for setup instructions. Everything is inside ..

Read more

I have routs with children and on the first load, everything working fine but once I’m staring through the site, the components starting to render twice. I’m not sure what I’m doing wrong. This is the route top structure: <React.Suspense fallback={<span>Loading…</span>}> <Switch> <Route path={"/dashboard/optionOne"} component={OptionOne} /> <Route path={"/dashboard/OptionTwo"} component={OptionTwo}/> <Switch> </React.Suspense> Then these are the ..

Read more