Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the spinupwp domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /sites/coreysalzano.com/files/wp-includes/functions.php on line 6121
TypeError: b.map is not a function – Corey Salzano

TypeError: b.map is not a function

If you’re building blocks for WordPress, and the error TypeError: b.map is not a function is logged in your browser’s developer console, you may have created a SelectControl component and failed to wrap the options in brackets to create an array.

This code will cause the error:

			<SelectControl
				label="Minimum Rating"
				value={ attributes.minimumRating }
				options={ 
					{ label: 'Great Deal', value: 'GREAT_PRICE' },
					{ label: 'Good Deal', value: 'GOOD_PRICE' },
					{ label: 'Fair Deal', value: 'FAIR_PRICE' }
				 }
				onChange={ onChangeMinimumRating }
			/>

This is the correct syntax:

			<SelectControl
				label="Minimum Rating"
				value={ attributes.minimumRating }
				options={ [
					{ label: 'Great Deal', value: 'GREAT_PRICE' },
					{ label: 'Good Deal', value: 'GOOD_PRICE' },
					{ label: 'Fair Deal', value: 'FAIR_PRICE' }
				] }
				onChange={ onChangeMinimumRating }
			/>