1. What are common security practices for React apps?
Use proper input validation to prevent XSS, avoid dangerouslySetInnerHTML, use HTTPS, manage environment variables securely, and implement authentication with tokens or cookies properly.
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
Google · React
Practice React questions specifically asked in Google interviews – ideal for online test preparation, technical rounds and final HR discussions.
Questions
8
Tagged for this company + subject
Company
View company-wise questions
Subject
React
Explore topic-wise practice
Go through each question and its explanation. Use this page for targeted revision just before your Google React round.
Use proper input validation to prevent XSS, avoid dangerouslySetInnerHTML, use HTTPS, manage environment variables securely, and implement authentication with tokens or cookies properly.
For complete preparation, combine this company + subject page with full company-wise practice and subject-wise practice. You can also explore other companies and topics from the links below.
React is only a library, not a full framework. It requires learning JSX and other tools like routing or state management separately. Beginners might find it complex due to the large ecosystem.
Hooks must be called at the top level of a component or custom hook, not inside loops, conditions, or nested functions. They must only be called inside React functions.
Hooks can only be called from functional components or other custom hooks, not from regular functions or class components.
Errors can be caught using getDerivedStateFromError and componentDidCatch lifecycle methods. These handle render-time errors gracefully.
Pure Components and memoized functions skip re-renders when inputs don’t change. React.memo prevents re-rendering of functional components, useMemo caches computed values, and useCallback caches functions.
const MemoComp = React.memo(MyComponent); const memoValue = useMemo(() => computeExpensive(value), [value]); const memoFn = useCallback(() => handleClick(id), [id]);
package.json lists your app’s metadata, scripts, and dependencies. It tells npm which libraries to install and how to run build or start commands. Dependencies are runtime libraries; devDependencies are for development tools like ESLint or Webpack.
useParams() retrieves URL parameters like /user/:id, while useSearchParams() or URLSearchParams helps read query strings like ?sort=desc. These hooks simplify dynamic navigation and filtering in apps.
const { id } = useParams();
const [query] = useSearchParams();
const sort = query.get('sort');