I hereby claim:
- I am ryardley on github.
- I am ryardl (https://keybase.io/ryardl) on keybase.
- I have a public key ASBYRGZRhFPvU4E3PXOXnk1w6KeFUwQNFax6Y_jPMfHVDwo
To claim this, I am signing this object:
| function RenderFunctionComponent() { | |
| const [firstName, setFirstName] = useState("Rudi"); | |
| const [lastName, setLastName] = useState("Yardley"); | |
| return ( | |
| <Button onClick={() => setFirstName("Fred")}>Fred</Button> | |
| ); | |
| } |
| let firstRender = true; | |
| function RenderFunctionComponent() { | |
| let initName; | |
| if(firstRender){ | |
| [initName] = useState("Rudi"); | |
| firstRender = false; | |
| } | |
| const [firstName, setFirstName] = useState(initName); |
I hereby claim:
To claim this, I am signing this object:
| npx -p react-native-cli react-native init CppReactNative && cd ./CppReactNative |
| // @flow | |
| import React, { Component } from "react"; | |
| import { NativeModules, StyleSheet, Text, View } from "react-native"; | |
| type Props = {}; | |
| type State = { message: string }; | |
| const { HelloWorld } = NativeModules; | |
| export default class App extends Component<Props, State> { | |
| state = { | |
| message: "loading..." |
| // ./ios/ReactBridge/RCTHelloWorld.h | |
| #import <React/RCTBridgeModule.h> | |
| @interface RCTHelloWorld : NSObject <RCTBridgeModule> | |
| @end |
| // ./ios/ReactBridge/RCTHelloWorld.m | |
| #import "RCTHelloWorld.h" | |
| #import "HWHelloWorld.h" | |
| @implementation RCTHelloWorld{ | |
| HWHelloWorld *_cppApi; | |
| } | |
| - (RCTHelloWorld *)init | |
| { |
| mkdir -p ios/ReactBridge |
| // ./ios/ReactBridge/RCTHelloWorld.m | |
| #import "RCTHelloWorld.h" | |
| @implementation RCTHelloWorld | |
| RCT_EXPORT_MODULE(); | |
| RCT_REMAP_METHOD(sayHello, | |
| resolver:(RCTPromiseResolveBlock)resolve | |
| rejecter:(RCTPromiseRejectBlock)reject) |
| // android/app/src/main/java/com/cppreactnative/helloworld/HelloWorldModule.java | |
| package com.cppreactnative.helloworld; | |
| import com.facebook.react.bridge.Promise; | |
| import com.facebook.react.bridge.ReactApplicationContext; | |
| import com.facebook.react.bridge.ReactContextBaseJavaModule; | |
| import com.facebook.react.bridge.ReactMethod; | |
| public class HelloWorldModule extends ReactContextBaseJavaModule { |