reactimagepassasprops

 passing the image as props:--

in App.js:

import K from './Component/k';

<K imgsrc="images/img1.jpg"></K>

in:-k.js

import React from 'react'

import { Button,Card } from 'react-bootstrap';

export default function k(props) {

    console.log(props);

    return (

        <div>

            <Button variant="warning">Warning</Button>

            <Card style={{ width: '18rem' }}>

  <Card.Img variant="top" src={props.imgsrc} />

  <Card.Body>

    <Card.Title>Card Title</Card.Title>

    <Card.Text>

      Some quick example text to build on the card title and make up the bulk of

      the card's content.

    </Card.Text>

    <Button variant="warning">Go somewhere</Button>

  </Card.Body>

</Card>

        </div>

    )

}


Comments

Popular posts from this blog

interview questions js[ Anurag Singh ProCodrr]

reactnative_creation