ReactJS – .JS vs .JSX

There is none when it comes to file extensions. Your bundler/transpiler/whatever takes care of resolving what type of file contents there is. There are however some other considerations when deciding what to put into a .js or a .jsx file type. Since JSX isn’t standard JavaScript one could argue that anything that is not “plain” JavaScript should go into …

Read more

Loop inside React JSX

Think of it like you’re just calling JavaScript functions. You can’t use a for loop where the arguments to a function call would go: See how the function tbody is being passed a for loop as an argument – leading to a syntax error. But you can make an array, and then pass that in as an argument: You can basically …

Read more

expected assignment or function call: no-unused-expressions ReactJS

This happens because you put bracket of return on the next line. That might be a common mistake if you write js without semicolons and use a style where you put opened braces on the next line. Interpreter thinks that you return undefined and doesn’t check your next line. That’s the return operator thing. Put your opened bracket on …

Read more

Loop inside React JSX

Think of it like you’re just calling JavaScript functions. You can’t use a for loop where the arguments to a function call would go: See how the function tbody is being passed a for loop as an argument – leading to a syntax error. But you can make an array, and then pass that in as an argument: You can basically …

Read more