Choose easy, medium or hard questions from our skill libraries to assess candidates of different experience levels.
Add multiple skills in a single test to create an effective assessment. Assess multiple skills together.
Add, edit or bulk upload your own coding questions, MCQ, whiteboarding questions & more...
Get a tailored assessment created with the help of our subject matter experts to ensure effective screening.
Choose from our 100,000+ question library and add your own to quickly make powerful custom tests
Q 1.
You’re developing a web form application in ReactJS. One of the primary features that your application should have
is the focus control feature of ReactJS. With this feature, you can automatically enable an input box auto-focused before
it is filled. The shown below picture of the application suggests that input box on the left side is not focus controlled
while the one on the right side is focus controlled. Your task is to set focus on an input box after it gets rendered.
To implement this, you have written the code given below for App component.
Few lines in the code are missing (//Write your code here). You need to complete the code.
At Blank 1: Create a ref to store a DOM element named textInput.
At Blank 2: Set focus on nameInput box.
At Blank 3: Set default value (“Focus doesn’t work here” & “Focus works here”) for the two input boxes as shown above.
At Blank 4: Use the `ref` callback to store a reference to the text input DOM - myInput.
At Blank 5: Render the App component appropriately.
Sample Script:
class App extends React.Component{
constructor(props)
{
super(props);
}
componentDidMount(){
}
render() {
return(
Q 2. You find that all react components must act like pure functions concerning their props. How is it possible for you to get components to change their output over time in response to user actions and network responses without violating this rule?
Q 3.
You are rendering a component A which in turn rendering another component B. You want the component B to hide itself even after the rendering.
What will you do to prevent the rendering of B?