How to create Style with typed safe in React JS

That ways very simple using ‘CSSProperties’

import { CSSProperties } from “react”;

create style

const BannerStyle : CSSProperties = {
background: `url(/img/product/shop-bg.jpg)`,
backgroundRepeat:’no-repeat’,
backgro…


This content originally appeared on DEV Community and was authored by Agik Setiawan

That ways very simple using 'CSSProperties'

import { CSSProperties } from "react";

create style

const BannerStyle : CSSProperties = {
        background: `url(/img/product/shop-bg.jpg)`,
        backgroundRepeat:'no-repeat',
        backgroundPosition:'center center',
        backgroundSize:'cover',
        position:'relative'
    }

and then use style into html tag

<div style={BannerStyle}>
</div>


This content originally appeared on DEV Community and was authored by Agik Setiawan


Print Share Comment Cite Upload Translate Updates
APA

Agik Setiawan | Sciencx (2022-04-09T04:19:47+00:00) How to create Style with typed safe in React JS. Retrieved from https://www.scien.cx/2022/04/09/how-to-create-style-with-typed-safe-in-react-js/

MLA
" » How to create Style with typed safe in React JS." Agik Setiawan | Sciencx - Saturday April 9, 2022, https://www.scien.cx/2022/04/09/how-to-create-style-with-typed-safe-in-react-js/
HARVARD
Agik Setiawan | Sciencx Saturday April 9, 2022 » How to create Style with typed safe in React JS., viewed ,<https://www.scien.cx/2022/04/09/how-to-create-style-with-typed-safe-in-react-js/>
VANCOUVER
Agik Setiawan | Sciencx - » How to create Style with typed safe in React JS. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/04/09/how-to-create-style-with-typed-safe-in-react-js/
CHICAGO
" » How to create Style with typed safe in React JS." Agik Setiawan | Sciencx - Accessed . https://www.scien.cx/2022/04/09/how-to-create-style-with-typed-safe-in-react-js/
IEEE
" » How to create Style with typed safe in React JS." Agik Setiawan | Sciencx [Online]. Available: https://www.scien.cx/2022/04/09/how-to-create-style-with-typed-safe-in-react-js/. [Accessed: ]
rf:citation
» How to create Style with typed safe in React JS | Agik Setiawan | Sciencx | https://www.scien.cx/2022/04/09/how-to-create-style-with-typed-safe-in-react-js/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.