This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HelloWorldOO { | |
public static void main(String[] args) { | |
String mensagem = new HelloWorldOO().retornaMensagem(); | |
System.out.println(mensagem); | |
} | |
public HelloWorldOO(){ | |
String mensagem = retornaMensagem(); | |
System.out.println(mensagem); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contexto (context) disponibiliza uma forma de passar dados entre a árvore de componentes sem precisar passar props manualmente em cada nível. | |
Em uma aplicação típica do React, os dados são passados de cima para baixo (de pai para filho) via props. Mas isso pode dar um pouco de trabalho em certos tipos de props (como preferências locais ou tema de UI), que são utilizadas por muitos componentes dentro da aplicação. Contexto (context) fornece a forma de compartilhar dados como esses, entre todos componentes da mesma árvore de componentes, sem precisar passar explicitamente props entre cada nível. | |
Quando Usar Contexto | |
Antes de você usar Contexto | |
API | |
React.createContext | |
Context.Provider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Considere esta declaração de variável: | |
Esta sintaxe estranha de tags não é uma string, nem HTML. | |
É chamada JSX e é uma extensão de sintaxe para JavaScript. Recomendamos usar JSX com o React para descrever como a UI deveria parecer. JSX pode lembrar uma linguagem de template, mas que vem com todo o poder do JavaScript. | |
JSX produz “elementos” do React. Nós iremos explorar a renderização para o DOM na próxima seção. Abaixo você descobrirá o básico de JSX necessário para começar. | |
Por que JSX? | |
O React adota o fato de que a lógica de renderização é inerentemente acoplada com outras lógicas de UI: como eventos são manipulados, como o state muda com o tempo e como os dados são preparados para exibição. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
$language = @$_COOKIE['current_language']; | |
if (! isset($language)) { | |
$language = $_SESSION['config_ini']['language']['default']; | |
} | |
?> | |
<!DOCTYPE html> | |
<html lang="<?php echo $language; ?>"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Assign the value "Hello!" to the variable "greeting" | |
$greeting = "Hello!"; | |
// Assign the value 8 to the variable "month" | |
$month = 8; | |
// Assign the value 2019 to the variable "year" | |
$year = 2019; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Assign the value "Hello!" to greeting | |
$greeting = "Hello!"; | |
// Empty the value greeting by setting it to null | |
$greeting = null; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Car { | |
function Car() { | |
$this->model = "Tesla"; | |
} | |
} | |
// create an object | |
$Lightning = new Car(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// prints: mysql link | |
$c = mysql_connect(); | |
echo get_resource_type($c) . "\n"; | |
// prints: stream | |
$fp = fopen("foo", "w"); | |
echo get_resource_type($fp) . "\n"; | |
// prints: domxml document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo str_word_count("Developer News"); // outputs 2 | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (condition) { | |
statement1; | |
statement2; | |
} |
OlderNewer