Add lib
This commit is contained in:
parent
6ba79c454d
commit
2874be65d9
@ -1,6 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
import './App.css'
|
||||
import { Canvas } from './components.js/Canvas'
|
||||
|
||||
export const App = () => {
|
||||
return (
|
||||
@ -9,7 +10,7 @@ export const App = () => {
|
||||
<h1>Ebermergen</h1>
|
||||
</header>
|
||||
<main>
|
||||
<canvas></canvas>
|
||||
<Canvas />
|
||||
</main>
|
||||
<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…
Reference in New Issue
Block a user