Вы не выполняете requiredText, поэтому вы передаете ссылку на функцию, а не на ее возвращаемое значение.
do:
const BannerStory = () => {
return <Banner header={requiredText()} />;
};
, чтобы "ввести"возвращаемое значение requiredText
, поэтому, если вы сделаете
console.log( requiredText )
, вы получите:
Object {key: null, ref: null, props: Object, _owner: null, _store: Object}
key: null
ref: null
props: Object
children: Array[2] <-- contains the text in requiredText
0: Object
type: "p"
key: null
ref: null
props: Object
children: "This isn't rendering"
_owner: null
_store: Object
1: Object
_owner: null
_store: Object
, тогда как выполнение функции захватывает возвращаемое значение