DEV Community

Devi
Devi

Posted on • Edited on

Simple React Interview Questions and Answers đź”Ť

1.What is state & props / Difference between state and props:
In reacting while building an application we'll break the page into small reusable components to make it more readable and to manage easily,
State: we've to use state to manage data inside a component.
Props: Props are some data that a component receives from another component

2. What "create-react-app" will do?
create-react-app will create a react project with necessary packages and bundlers (react by default has a bundler called web pack). It'll compile and run the project in localhost.

3. what is the robot.txt file in react?
if web designers create something on their website and don't want Google or other search engines to access it, they'll write it in robot.txt and it will be helpful for SEO too.

4. Types of components in react?
Functional components: A normal JS function that can manage multiple functions inside that.
Class-based components: created using class keywords in Javascript.
Functional is a new way, easy to use compared to class components

5. What is JSX?
JavaScript XML, which will be used to create HTML elements inside DOM.

6. what are Hooks in react?
Hooks are utility functions. to manage a state in functional components we'll use state (useState hook) from react.

useState: to create a special dynamic variable by re-rendering automatically.
UseState will return an array 
const [data,setData] = useState('')

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

Neon image

Next.js applications: Set up a Neon project in seconds

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Get started →

đź‘‹ Kindness is contagious

DEV works best when you're signed in—unlocking a more customized experience with features like dark mode and personalized reading settings!

Okay