I'm looking to have my webpage look similar to this: Getting a hang on the syntax and conventions of having components can be simple, but as you can imagine, I'm not having a wonderful time. A lot of the code I've written below almost feels like pseudocode, and I'm not sure how closely I'm writing to it being real code.
Are there any red flags you can spot that would help improve this code?
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<div id="app"></div>
<script type="text/babel">
const prod_img = 'http://10.104.0.15/care-products.jpg';
const prod_name = 'Bath and Body Products';
const prod_description = 'The bath and body category includes all the items you need to take care of your skin and external body surfaces.';
const ProductImage = (props) => {
return <img src={props.prod_img} />;
};
const ProductName = (props) => {
return <h2>{props.prod_name}</h2>;
};
const ProductDesc = (props) => {
return <p>{props.prod_description}</p>;
};
const Product = (props) => {
return (
<div>
<ProductImage image={prod_img} />
<ProductName name={prod_name} />
<ProductDesc description={prod_description}/>
</div>
);
};
ReactDOM.render(<Product />, document.getElementById('app'));
</script>
ReactDOM.rendertakes in two arguments, the component you want to render, and the corresponding place in HTML you want to render it:ReactDOM.render(<Product />, document.getElementById('my-root-id-here'))image={prod_img}etc. as the curly braces indicate a JS expression