Below you will find pages that utilize the taxonomy term “React”
Posts
Create your react component
Creating your own react component is supereasy.
Syntax class MyElement extends React.Component { constructor(props) { super(props); } render() { return react.createElement('p',null,'This is some text'); } } Or const myElement = (props) =>{ return react.createElement('p',null,'This is some text') } Here we have seen two ways to create a react component one using classes the other using simple arrow function.
How to use it const myElement = react.createElement(MyElement); root.render(myElement); Two important things happen here.
Posts
Intro to react
React is a frontend javascript framework which allows us to decouple the logic and rederning of an element in DOM.
Creating an React Element React.createElement('Element name', props, ...children) Mounting a React Elment After creating an element you will need a place to mount the element until then the element you created will not be present in HTML DOM.
The element you will mount your react element to is called root.