By creating a simple "Hello World" example application first in Vanilla Javascript, and then in Preact without any tools, We'll learn what type of problems preact are solving for us and how are works at a low level. Then we'll switch to a Webpack + Babel setup We'll cover some fundamental concepts such as, which imports we need, how to Create a component, how to use JSX and the finally how to render we component into a target element in a Web page.
Index.js
Import {h, render} from ' Preact '; the import App from './components/app '; render (</> , Document.queryselector (' main '));
Here, we must import ' H ' even we don ' t use it. It allows preact convert JSX to JS render to the DOM.
App.js:
Import {h} from ' Preact '; const APP = () = { return ( <Div> C11/>hello World!!! </ Div > );}; Export default App;
[Preact] Create a Hello world App with Preact