{ 'This would be javascript' }
.class
to define HTML classes, as it is reserved for JavaScript. Instead, you have to use className
.<br />
. <br>
is not valid.<div>
can be written as <div />
or <div>something inside</div>
. The difference is that in the first syntax version there is no way to include anything inside it.<>
and </>
.<Example />
), the value will be Hi Aria, nice to meet you!
.<div>
, just by nesting elements inside the Component:<h1>
where we defined the children
, so the final HTML would be:value
: the name of the state variable you want to be changed after any events you define.setValue
: the name of the function we will use to update the value of value
.initialValue
: the value of value
at the first render.0
and two buttons to update it: one to update the value directly to 5
when clicking it, and the other one to add 1
to the actual count:useEffect
will run each time the component re-renders.[]
as a second argument.condition && resultIfTrue
) when we want to return something if the condition is true, and nothing if not. In the example below, it will return the <p>It is right</p>
element if value is > 20 and nothing if it isn't.condition ? resultIfTrue : resultIfFalse
) if we want to return something if the statement is false. In the example below, it will return the <p>It is right</p>
element if value is > 20 and will render <p>It is NOT right</p>
if that statement is not true.null
:map()
method:state
tree which can be accessed from any component of the app. This helps you keep different components in sync, and it is also a medium to communicate between them.state
is used and how easy it is to manage it with Frontity Connect. As said before, you should imagine the state as an object with info about the app:connect
from the "frontity"
package.state
as a prop in the component.connect(Component)
.connect
only on the default export of the file:actions
and libraries
to the components, like this: