From 97f8685621eae1749034ab65bbb5ad9103d52b78 Mon Sep 17 00:00:00 2001 From: Elyes Ben Abdelkader Date: Tue, 10 Jan 2023 21:27:07 +0100 Subject: [PATCH] Update question #104 answer --- README.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1aa30ce3..587d2693 100644 --- a/README.md +++ b/README.md @@ -2611,7 +2611,7 @@ You can download the PDF and Epub version of this repository from the latest run 104. ### Is it possible to use React without rendering HTML? - It is possible with latest version (>=16.2). Below are the possible options: + It is possible. Below are the possible options: ```jsx harmony render() { @@ -2619,18 +2619,34 @@ You can download the PDF and Epub version of this repository from the latest run } ``` + ```jsx harmony + render() { + return true + } + ``` + ```jsx harmony render() { return null } ``` + React version >=16.0.0: + ```jsx harmony render() { return [] } ``` + ```jsx harmony + render() { + return "" + } + ``` + + React version >=16.2.0: + ```jsx harmony render() { return @@ -2643,7 +2659,13 @@ You can download the PDF and Epub version of this repository from the latest run } ``` - Returning `undefined` won't work. + React version >=18.0.0: + + ```jsx harmony + render() { + return undefined + } + ``` **[⬆ Back to Top](#table-of-contents)**