-
Notifications
You must be signed in to change notification settings - Fork 19
Usage with React
Richard Venneman edited this page Feb 13, 2018
·
1 revision
You can use the componentDidMount
lifecycle hook in your components:
import React, { Component } from "react";
import Floatl from "floatl";
class MyComponent extends Component {
componentDidMount() {
const floatl = new Floatl(this.floatlElement);
}
render() {
return (
<div
className="floatl"
ref={el => {
this.floatlElement = el;
}}
>
<label for="first_name" className="floatl__label">
First name
</label>
<input
name="first_name"
type="text"
className="floatl__input"
placeholder="First name"
/>
</div>
);
}
}
export default MyComponent;