Skip to content

Instantly share code, notes, and snippets.

@OlivierJM
Created April 2, 2019 17:10
Show Gist options
  • Save OlivierJM/bb8cb25d832b56d40b98e7f9079cdb4c to your computer and use it in GitHub Desktop.
Save OlivierJM/bb8cb25d832b56d40b98e7f9079cdb4c to your computer and use it in GitHub Desktop.
questions

Theory

  1. Briefly explain the difference between props and states

  2. What are synthetic events in React?

  3. What are refs and give example of a use case?

  4. What are portals in React?

  5. What will the code below output to the console and why?

var myObject = {
  foo: "bar",
  func: function() {
      var self = this;
      console.log("outer func:  this.foo = " + this.foo);
      console.log("outer func:  self.foo = " + self.foo);
      (function() {
          console.log("inner func:  this.foo = " + this.foo);
          console.log("inner func:  self.foo = " + self.foo);
      }());
  }
};
myObject.func();
  1. Consider the two functions below. Will they both return the same thing? Why or why not?
function foo1()
{
  return {
      bar: "hello"
  };
}

function foo2()
{
  return
  {
      bar: "hello"
  };
}
  1. Briefly with examples explain how you would share a component state to another.

Practice

Create a simple weather app in react-native app, it should display the weather of the current location and allow filtering to check other locations, other details details to be displayed should be the current date, city name and country and time. Feel free to use the openweathermap API, the interface should be intuitive and easy to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment