Skip to content

Instantly share code, notes, and snippets.

@rahulmalhotra
Created October 15, 2017 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulmalhotra/9c5ab47ae038a2c77e0bb30a0018e6a4 to your computer and use it in GitHub Desktop.
Save rahulmalhotra/9c5ab47ae038a2c77e0bb30a0018e6a4 to your computer and use it in GitHub Desktop.
Learning React
----------------------------------------------------------------------------------------------------------------------------
To add eslint :-
1. npm install -g eslint
2. add .eslintsrc to main project directory of react-native project
3. add this code to .eslintsrc -
{
"extends": "rallycoding"
}
4. npm install --save-dev eslint-config-rallycoding
5. In sublime text install package "Sublime Linter" and "sublimelinter-contrib-eslint"
-----------------------------------------------------------------------------------------------------------------------------
To use this keyword in try or catch block :-
1. use another variable like - var that = this; in function where u have try or catch block or any overridden code block.
2. use 'that' instead of this everywhere in block where u want to use 'this' keyword
------------------------------------------------------------------------------------------------------------------------------
Error:- no function like:- signInWithEmailAndPassword when using this from firebase library in react- native project
Solution:- Make sure to bind the component function when you are using it.
Example Code Snippet:-
firebase.auth().signInWithEmailAndPassword(email, password)
.then(this.onLoginSuccess.bind(this)); -- this binding is necessary at the end of code
------------------------------------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment