Gutenberg – Custom blocks not working as expected?

What you are writing in your js file is not “real” Javascript Code, but an extension named “JSX” which can help you write the elements like XML-Code.

Before you can “use” the block js file, you first have to “compile” it into “real” Javascript code. You can use npx and webpack for this.

The Tutorial you used actually describes how you can setup this environment. Just start from the first part of the tutorial, if you want to learn the basics, or at least at part 6 (Where the setup of the npx and webpack components are described).

Happy Coding.