Skip to content

Instantly share code, notes, and snippets.

@jabdul
Last active June 25, 2020 08:53
Show Gist options
  • Save jabdul/1cd7584b9ca1e871c00b6442d941f56a to your computer and use it in GitHub Desktop.
Save jabdul/1cd7584b9ca1e871c00b6442d941f56a to your computer and use it in GitHub Desktop.
Q1. What is the InteractionManager and how is it used? Why is it important?
Q2. Which node_modules will run in React Native? How can we test for this?
Q3. What is wrong with this code for querying a native API?
class GyroJs {
setGyroPosition(pos) {
if (pos === null || typeof pos === 'undefined') {
throw new Error('The position must be defined');
}
this.pos = pos;
}
constructor() {
const gyroscopePosition = NativeModules.MyGyroModule.gyroPosition();
this.setGyroPosition(gyroscopePosition);
}
}
Q4. Write a reducer that returns a new state with isAuthorised set to true.
const initialState = {
user: {
isAuthorised: false,
}
};
The reducer function has the following signature:
(previousState = initialState, action) => newState
Where the action has a payload containing a property isAuthorised set to true.
Q5.
a) Write a pseudo-code that uses the fetch API which makes request to https://jsonplaceholder.typicode.com/users
b) Render as a list in the UI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment