001package react4j.dom; 002 003import javax.annotation.Nonnull; 004import javax.annotation.Nullable; 005import jsinterop.annotations.JsFunction; 006import jsinterop.annotations.JsOverlay; 007import jsinterop.annotations.JsPackage; 008import jsinterop.annotations.JsType; 009import react4j.ReactNode; 010 011/** 012 * A React root represents the top level DOM element that react binds to. 013 */ 014@JsType( isNative = true, namespace = JsPackage.GLOBAL, name = "?" ) 015public interface ReactRoot 016{ 017 @FunctionalInterface 018 @JsFunction 019 interface PostRenderCallbackFn 020 { 021 /** 022 * Perform an action. 023 */ 024 void call(); 025 } 026 027 @FunctionalInterface 028 @JsFunction 029 interface PostUnmountCallbackFn 030 { 031 /** 032 * Perform an action. 033 */ 034 void call(); 035 } 036 037 @JsOverlay 038 default void render( @Nonnull ReactNode children ) 039 { 040 render( children, null ); 041 } 042 043 void render( @Nonnull ReactNode children, @Nullable PostRenderCallbackFn callback ); 044 045 @JsOverlay 046 default void unmount() 047 { 048 unmount( null ); 049 } 050 051 void unmount( @Nullable PostUnmountCallbackFn callback ); 052}