HELP! I'm doing React + Laravel 6. I want to pass a string to my props in my React component but this has to be passed/written from a file.blade.php file.
** file.blade.php **
<div id="MyComponent"></div>
<div id="MyComponent"> string I want to pass</div> I can't get this innerHTML as well as ID is already tagged.
<div id="MyComponent" customProp="string to I want to pass"></div> I'm not sure if it is possible to use a custom property or the native property of an HTML tag and fetch it inside the JS component but I know this is possible for React components.
I know that php files can't type <MyComponent /> inside a blade.php file like I can in JS and php files can only use a component through ID tag. Please don't suggest fetch, i know that it would solve this problem but the process is needlessly longer for the desired effect, just for display.I'd rather hard code this component in HTML.
Desired effect: I want this React Component to adjust it's text based on the passed string. I can simply hard code the text inside JS but component wouldn't be reusable and defeat the componentization.