I have recently installed intellij idea on my PC and started react-native application. I installed all libraries required for react native and react js. Also installed node js module and all plugins for this ide. Still i am getting error below like this in import statement.
When i move to that line that shows me error like.
-> Install TypeScript definition for better type information.
But my typeScript definition are also as per required.
Also I have changed my JS to ReactJSX.
I have attached image over here for reference.
You should try to create a new project using following commands
npm install -g create-react-app
create-react-app my-app
cd my-app
npm start
If you still facing error then try to use vscode editor and select react language. If you still face issue let me know
Related
I had a normal react web app project. There was no typescript implementation.
So I added
npm install --save typescript #types/node #types/react
#types/react-dom #types/jest
This command is to bring typescript into the project.
I have converted some components to typescript and some are still remaining as vanilla js components. Everything works in the local environment. Even though the build command is working without any issues. Once I deploy the build folder to the server It gives a completely blank page and no console errors as well.
This is my firebase hosted link https://portfolio-e251d.web.app/
This is my repo https://github.com/pathum-kalhan/react-material-ui-portfolio
Are there any special steps to build a partly typescript react project?
I'm trying to import a compass module without success using expo and react native
LINK to library
The error appears when I uncomment the import line, which gives me the error:
import RNSimpleCompass from 'react-native-simple-compass';
null is not an Object (Evaluating 'RNSimpleCompass.start')
I basically install the library using the provided instructions:
npm install react-native-simple-compass --save
I also tried linking it
npx react-native link react-native-simple-compass
then I run
npm start
which starts expo and gives me the error
I usually install and run other npm packages without problem, but this one keeps complaining when importing it.
I checked that the library is in my package.json dependencies. I even tried deleting the node_modules folder and re running npm install to reinstall all dependencies, but the error persist.
Am I missing something?
When you have expo "managed" project (without "ios" and "android" directories) you can't use react-native libraries that contain native code(objc or java). It worked in other cases because you probably were adding js only libraries or libraries that are explicitly supported by expo.
If you want to use that library you would need to eject to bare workflow(expo eject). You will still have access to all expo libraries you are currently using, but you won't be able to build it on Expo servers.
I want to add https://www.npmjs.com/package/react-dropzone to a React project written in TypeScript. And I am using the Yarn package manager.
So I hit the command yarn add #types/react-dropzone, which actually installs another deprecated package https://www.npmjs.com/package/#types/react-dropzone.
Currently in my package.json ->
"#types/react-dropzone": "^5.1.0"
I found something is wrong when I saw it working in Firefox but not in Chrome.
How can I install the actual package(https://www.npmjs.com/package/react-dropzone)?
As npm site says, you dont need #types/react-dropzone because the original package now contains everything needed.
I am trying to implement automated process of converting html into react components. I am following below link to automatically convert html into react components.
https://www.npmjs.com/package/html-to-react-components
but i am getting failure of command html2react. I also installed the package by using below command.
"npm i -g html-to-react-components".
But still it is saying "'html2react' is not recognized as an internal or external command,operable program or batch file".
The problem was that I installed the package globally. As i installed globally so i have to place my html file in C:/Users/YourComputerName/AppData/Roaming/npm.
and then from CLI I have to open the above folder and directory in which my html2react package is installed.
And then from that directory I have to implement the html2react command.
For clear understanding i am also attaching snapshot as well. CLI command description
Have a good learning.
I'm very new to React Native, barely two weeks into it. I've installed node.js (ver 10.15.0), I've also installed yarn and downloaded WebStorm.
The problem is that I can't run a simple project created by WebStorm, it throws an error
Command start unrecognized. Make sure that you have run npm install and that you are inside a react-native project.
I've cd into my WebStorm projects folder and run npm install in command prompt countless times but it's still throwing the error. Some online suggestions said I should set my path correctly, but I don't really know how to go about it.
Any help will be appreciated.
You should know The best IDE for react native is VSCode (visual studio code) and don't create project with IDE (you should use commands for create project. just use IDE for manage codes)
use CMD or PowerShell (Recommended) for commands
Create a folder for your project and in the project directory run this commands :
npm install -g expo-cli
expo init Yourprojectname
cd Yourprojectname
npm start
For run android project
react-native run-android
For run android project
react-native run-ios
Also its better to read this tutorial : https://facebook.github.io/react-native/docs/getting-started