I'm not sure which way I' supposed to import React in my React Native app.
If I need to use a hook like useState should I import React with: import React, { useState } from 'react';, import { useState } from 'react';, import * as React from 'react';, or import * from 'react';?
If I don't need any hooks should I use: import React from 'react';, import 'react';, import * as React from 'react';, or import * from 'react';?
As of react version 17+, you don't need to import React from 'react' anymore. Read more about the JSX transformation.
Hooks are named exports, so you need to import hooks as:
import {useState, useEffect /* and others */} from 'react'
If you are using a react version below 17, you need to import React. Since React would be a default import these are all refer to the same thing:
import React from 'react'
import * as React from 'react'
So you should do import React, {/* hooks you are using */} from 'react'.
You can even do import * as Whatever from 'react', since it is not a named export.