create block gutenberg wordpress from Scratch

 first you need to make file js

that will contain block script


 file.js

const { registerBlockType } = wp.blocks;
console.log("am here");


registerBlockType("shit-block/shit", {
    // attributes
    title: "call to action",
    describe: "this test block to learn make blocks",
    icon: "format-image",
    category: "layout",

    // edit
    edit: () => { return "💩"; },


    // save
    save: () => {},
});



call and register file.js

in functions files
function call_gutenberg(){
   
    wp_enqueue_script( "scripts-jss" , get_template_directory_uri()."/js/blocks.js",array('wp-blocks'));

    register_block_type( 'shit-block', array(
        "editor_script" => "js-gutenberg"
    ));
}

add_action( "init", "call_gutenberg");

right now you finish the basic of block if you tried to add script React in edit or save functions you will get error