mirror of
https://github.com/rive-app/rive-react.git
synced 2026-03-13 08:22:30 +08:00
Add typescript example
This commit is contained in:
19
examples/basic-typescript/src/App.tsx
Normal file
19
examples/basic-typescript/src/App.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useRive, UseRiveParameters } from "rive-react";
|
||||
|
||||
function App() {
|
||||
const params: UseRiveParameters = {
|
||||
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-typescript/src/index.tsx
Normal file
10
examples/basic-typescript/src/index.tsx
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")
|
||||
);
|
||||
1
examples/basic-typescript/src/react-app-env.d.ts
vendored
Normal file
1
examples/basic-typescript/src/react-app-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="react-scripts" />
|
||||
Reference in New Issue
Block a user