mirror of
https://github.com/rive-app/rive-react.git
synced 2026-03-13 08:22:30 +08:00
Add examples for using rive-react
This commit is contained in:
19
examples/basic-with-hook/src/App.js
Normal file
19
examples/basic-with-hook/src/App.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useRive } from "rive-react";
|
||||
|
||||
function App() {
|
||||
const params = {
|
||||
src: "poison-loader.riv",
|
||||
autoplay: true,
|
||||
};
|
||||
|
||||
const { RiveComponent } = useRive(params);
|
||||
|
||||
return (
|
||||
// The animation will fit to the parent element.
|
||||
<div style={{ height: "500px", width: "500px" }}>
|
||||
<RiveComponent />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
10
examples/basic-with-hook/src/index.js
Normal file
10
examples/basic-with-hook/src/index.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import App from "./App";
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById("root")
|
||||
);
|
||||
Reference in New Issue
Block a user