DEV Community

loading...

Discussion on: Project 50 of 100 - Firebase Sign Up and Login with React Router

Collapse
youssefrabeiii profile image
Youssef Rabei

Hey James great post, i loved it but if you want your code to be highlighted "Colored" like this

const [userExists,setUserExists] = useState(false);

auth.onAuthStateChanged((user) => {
    if (user) {
      setUserExists(true);
      console.log('Signed in as '+user.email);
    } else {
      setUserExists(false);
    }
  });
Enter fullscreen mode Exit fullscreen mode

add the language like javascript or jsx "I used jsx for the code above" after the three "backticks" (No spaces between them)

and just a note it would be better if you displayed a paragraph when there is an error not an alert so you can style it with CSS

Collapse
ridhikgovind profile image
Ridhik Govind

Nice tip. Gonna implement it next time in my next article. Thanks :)

Collapse
jwhubert91 profile image
James Hubert Author

Hey! How'd you do this Youssef? This is really great.

Collapse
youssefrabeiii profile image
Youssef Rabei

Everytime I try to show it it automatically make it code but you should put the language name after the three backticks (the three things that look like a comma) and it will highlight it automatically

Thread Thread
jwhubert91 profile image
James Hubert Author

Oh got it. Like

some code here...
Enter fullscreen mode Exit fullscreen mode
Thread Thread
jwhubert91 profile image
James Hubert Author

Nice!

const thankful = true;

if (thankful) {
  console.log("Thanks Youssef!");
}
Enter fullscreen mode Exit fullscreen mode