type state = {start: bool};
type action =
| Start
| End;
let component = ReasonReact.reducerComponent("Example");
let make = (_children) => {
...component,
initialState: () => {start: false},
reducer: (action, state) =>
switch (action) {
| Start => ReasonReact.Update({...state, start: true})
| End => ReasonReact.Update({...state, start:false})
},
render: self =>
<div>
<Transition timeout=600 in_=self.state.start>
...((animationState) =>
switch(animationState) {
| Transition.Entering => (ReasonReact.string("State: " ++ "Entering"))
| Transition.Entered => (ReasonReact.string("State: " ++ "Entered"))
| _ => (ReasonReact.string("State: " ++ Transition.stringOfState(animationState)))
}
)
</Transition>
<button onClick=(_ => self.send(Start)) disabled={self.state.start}>
(ReasonReact.string("Start Animation"))
</button>
<button onClick=(_ => self.send(End)) disabled= {! self.state.start}>
(ReasonReact.string("End Animation"))
</button>
</div>
};
-
Notifications
You must be signed in to change notification settings - Fork 0
briansunter/bs-react-transition-group
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Reasonml Bindings for react-transition-group
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published