Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 669 Bytes

inline-component-styles-with-reason-react.md

File metadata and controls

29 lines (23 loc) · 669 Bytes

Inline Component Styles With Reason React

If you've written much React.js, the following may look familiar:

<span style={{
  width: "10px",
  height: "10px",
  backgroundColor: "rgb(200, 64, 128)"
}} />

This is how we do inline styles with JSX in JavaScript.

When it comes to doing inline styles with JSX in our ReasonML code, the best approach for now is to use a make function for styles provided by the React DOM bindings.

<span style=(
  ReactDOMRe.Style.make(
    ~width="10px",
    ~height="10px",
    ~backgroundColor="rgb(200, 64, 128)",
    ())
)/>

source