Support » Developing with WordPress » Block editor Flex component not working

  • Resolved rafaucau

    (@rafaucau)


    I am trying to use a Flex component (https://developer.wordpress.org/block-editor/components/flex/) in my custom block, but then my block stops working (This block has encountered an error and cannot be previewed.) and I get a console warning:

    
    react_devtools_backend.js:2273 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
    

    My block works when I remove a Flex component from it, so it is definitely the fault of this component. Other components are working properly.

    To reproduce this error:

    • run a clean Worpdress installation in wp-env or another environment
    • create a plugin using npx @wordpress/create-block
    • copy the code from the documentation to the created block

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey @rafaucau,

    I tried the code from that page and it worked just fine. Can you share your code so I could see it?

    Thank you!

    Thread Starter rafaucau

    (@rafaucau)

    @hardeepasrani
    After upgrading to WordPress 5.5, it works.
    It looks like the documentation was too new

    Hey @rafaucau,

    A lot of components are made after WordPress releases so they may not always come with a stable WordPress release. You can always check them by opening the editor and putting it like this in browser’s console log:

    wp.components

    Which will list all the available components. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Block editor Flex component not working’ is closed to new replies.