Add lib
This commit is contained in:
parent
6ba79c454d
commit
2874be65d9
@ -1,6 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import './App.css'
|
import './App.css'
|
||||||
|
import { Canvas } from './components.js/Canvas'
|
||||||
|
|
||||||
export const App = () => {
|
export const App = () => {
|
||||||
return (
|
return (
|
||||||
@ -9,7 +10,7 @@ export const App = () => {
|
|||||||
<h1>Ebermergen</h1>
|
<h1>Ebermergen</h1>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<canvas></canvas>
|
<Canvas />
|
||||||
</main>
|
</main>
|
||||||
<footer>Made by Alfred Melch</footer>
|
<footer>Made by Alfred Melch</footer>
|
||||||
</>
|
</>
|
||||||
|
12
src/components.js/Canvas.js
Normal file
12
src/components.js/Canvas.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import React, { useLayoutEffect, useRef } from 'react'
|
||||||
|
import { main } from '../lib'
|
||||||
|
|
||||||
|
export const Canvas = () => {
|
||||||
|
const canvasRef = useRef(null)
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
main(canvasRef.current)
|
||||||
|
})
|
||||||
|
|
||||||
|
return <canvas width={500} height={400} ref={canvasRef} />
|
||||||
|
}
|
6
src/lib/index.js
Normal file
6
src/lib/index.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
console.log('import entrypoint lib')
|
||||||
|
|
||||||
|
export function main(canvas) {
|
||||||
|
console.log('entrypoint function')
|
||||||
|
console.log(canvas)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user