#Why are boolean component props always undefined?
1 messages · Page 1 of 1 (latest)
Based on the information provided in the extracts, there's no specific mention of an issue with passing boolean values as props in Astro. The standard way of passing props, including booleans, is correctly shown in your example.
However, there are a few potential issues that could cause myBool to be undefined:
-
There might be a typo or mismatch in the prop name. Ensure that the prop name you're passing from the parent component matches exactly with the one you're trying to access in the child component.
-
The prop might not be correctly destructured from
Astro.props. Make sure you're using the correct syntax for destructuring props fromAstro.propsin your component. -
There might be an issue with the Astro version you're using. Some users have reported issues with props becoming
nullorundefinedin certain circumstances (source (https://github.com/withastro/astro/issues/7528)).